@NonNull @Override public SourceFile getSourceFile() { return getOwnerElement().getSourceFile(); } }
@NonNull private synchronized List<Actions.AttributeRecord> getAttributeRecords(@NonNull XmlAttribute attribute) { XmlElement originElement = attribute.getOwnerElement(); NodeKey storageKey = originElement.getOriginalId(); @Nullable Actions.DecisionTreeRecord nodeDecisionTree = mRecords.get(storageKey); // by now the node should have been added for this element. Preconditions.checkNotNull(nodeDecisionTree, "No record for key [%s]", storageKey); List<Actions.AttributeRecord> attributeRecords = nodeDecisionTree.mAttributeRecords.get(attribute.getName()); if (attributeRecords == null) { attributeRecords = new ArrayList<Actions.AttributeRecord>(); nodeDecisionTree.mAttributeRecords.put(attribute.getName(), attributeRecords); } return attributeRecords; }
if (getOwnerElement().getType().getMergeType() == MergeType.MERGE_CHILDREN_ONLY) { error = String.format( "Attribute %1$s value=(%2$s) from %3$s\n" printPosition(), getValue(), getOwnerElement().getType().toXmlName()); } else { error = String.format( getValue(), mXml.getName(), getOwnerElement().getType().toXmlName(), higherPriority.getOwnerElement().printPosition());
void addMessage(@NonNull MergingReport.Builder report, @NonNull SourcePosition position, @NonNull MergingReport.Record.Severity severity, @NonNull String message) { report.addMessage( new SourceFilePosition(getOwnerElement().getDocument().getSourceFile(), position), severity, message); }
this, Actions.ActionType.ADDED, getOwnerElement().getAttributeOperationType(getName()));
/** * Records an attribute action taken by the merging tool * * @param attribute the attribute in question. * @param attributePosition the attribute's position. * @param actionType the action's type * @param attributeOperationType the original tool annotation leading to the merging tool * decision. */ synchronized void recordAttributeAction( @NonNull XmlAttribute attribute, @NonNull SourcePosition attributePosition, @NonNull Actions.ActionType actionType, @Nullable AttributeOperationType attributeOperationType) { XmlElement originElement = attribute.getOwnerElement(); Actions.AttributeRecord attributeRecord = new Actions.AttributeRecord( actionType, new SourceFilePosition( originElement.getDocument().getSourceFile(), attributePosition), attribute.getOriginalId(), null, /* reason */ attributeOperationType ); recordAttributeAction(attribute, attributeRecord); }