[#699] add otherAttributes if class has wildcard on plugins#700
Merged
Conversation
mattrpav
requested changes
May 28, 2026
Collaborator
mattrpav
left a comment
There was a problem hiding this comment.
I think the changes look good, but there probably should be some unit test coverage to test sample scenarios
Collaborator
Author
|
There is already some class generating these new attributes public class IssueGH98Type implements Cloneable, CopyTo, Equals, HashCode, MergeFrom, ToString {
/// ...
@Override
public String toString() {
final ToStringStrategy strategy = JAXBToStringStrategy.getInstance();
final StringBuilder buffer = new StringBuilder();
append(null, buffer, strategy);
return buffer.toString();
}
@Override
public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
strategy.appendStart(locator, this, buffer);
appendFields(locator, buffer, strategy);
strategy.appendEnd(locator, this, buffer);
return buffer;
}
@Override
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
{
Map<QName, String> theOtherAttributes = this.getOtherAttributes();
strategy.appendField(locator, this, "otherAttributes", buffer, theOtherAttributes, true);
}
return buffer;
}
@Override
public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) {
if ((object == null)||(this.getClass()!= object.getClass())) {
return false;
}
if (this == object) {
return true;
}
final IssueGH98Type that = ((IssueGH98Type) object);
{
Map<QName, String> lhsOtherAttributes = this.getOtherAttributes();
Map<QName, String> rhsOtherAttributes = that.getOtherAttributes();
if (!strategy.equals(LocatorUtils.property(thisLocator, "otherAttributes", lhsOtherAttributes), LocatorUtils.property(thatLocator, "otherAttributes", rhsOtherAttributes), lhsOtherAttributes, rhsOtherAttributes, true, true)) {
return false;
}
}
return true;
}
@Override
public boolean equals(Object object) {
final EqualsStrategy strategy = new IssueJIIB42EqualsStrategy();
return equals(null, null, object, strategy);
}
@Override
public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) {
int currentHashCode = 1;
{
Map<QName, String> theOtherAttributes = this.getOtherAttributes();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "otherAttributes", theOtherAttributes), currentHashCode, theOtherAttributes, true);
}
return currentHashCode;
}
@Override
public int hashCode() {
final HashCodeStrategy strategy = JAXBHashCodeStrategy.getInstance();
return this.hashCode(null, strategy);
}
@Override
public Object clone() {
return copyTo(createNewInstance());
}
@Override
public Object copyTo(Object target) {
final CopyStrategy strategy = JAXBCopyStrategy.getInstance();
return copyTo(null, target, strategy);
}
@Override
public Object copyTo(ObjectLocator locator, Object target, CopyStrategy strategy) {
final Object draftCopy = ((target == null)?createNewInstance():target);
if (draftCopy instanceof IssueGH98Type) {
final IssueGH98Type copy = ((IssueGH98Type) draftCopy);
{
Map<QName, String> sourceOtherAttributes = this.getOtherAttributes();
Map<QName, String> copyOtherAttributes = copy.getOtherAttributes();
copyOtherAttributes.clear();
copyOtherAttributes.putAll(sourceOtherAttributes);
}
}
return draftCopy;
}
@Override
public Object createNewInstance() {
return new IssueGH98Type();
}
@Override
public void mergeFrom(Object left, Object right) {
final MergeStrategy strategy = JAXBMergeStrategy.getInstance();
mergeFrom(null, null, left, right, strategy);
}
@Override
public void mergeFrom(ObjectLocator leftLocator, ObjectLocator rightLocator, Object left, Object right, MergeStrategy strategy) {
if (right instanceof IssueGH98Type) {
final IssueGH98Type target = this;
final IssueGH98Type leftObject = ((IssueGH98Type) left);
final IssueGH98Type rightObject = ((IssueGH98Type) right);
{
Map<QName, String> lhsOtherAttributes = leftObject.getOtherAttributes();
Map<QName, String> rhsOtherAttributes = rightObject.getOtherAttributes();
Map<QName, String> mergedOtherAttributes = target.getOtherAttributes();
mergedOtherAttributes.clear();
mergedOtherAttributes.putAll(((Map<QName, String> ) strategy.merge(LocatorUtils.property(leftLocator, "otherAttributes", lhsOtherAttributes), LocatorUtils.property(rightLocator, "otherAttributes", rhsOtherAttributes), lhsOtherAttributes, rhsOtherAttributes, true, true)));
}
}
}
} |
Collaborator
Author
|
@mattrpav : added tests case for plugins |
Collaborator
Author
Also added test case for |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #699
Add support for
otherAttributesin many plugins :