@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof RootKey)) { return false; } RootKey other = (RootKey) obj; if (type != null) { return type == other.type; } return id.equals(other.id); }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof RootKey)) { return false; } RootKey other = (RootKey) obj; if (type != null) { return type == other.type; } return id.equals(other.id); }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (!(obj instanceof RootKey)) { return false; } RootKey other = (RootKey) obj; if (type != null) { return type == other.type; } return id.equals(other.id); }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj == null || obj.getClass() != AttributeKey.class) { return false; } AttributeKey<?> o = (AttributeKey<?>) obj; return id.equals(o.id) && datatype == o.datatype; }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj == null || obj.getClass() != AttributeKey.class) { return false; } AttributeKey<?> o = (AttributeKey<?>) obj; return id.equals(o.id) && datatype == o.datatype; }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj == null || obj.getClass() != AttributeKey.class) { return false; } AttributeKey<?> o = (AttributeKey<?>) obj; return id.equals(o.id) && datatype == o.datatype; }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj == null || obj.getClass() != ElementKey.class) { return false; } ElementKey<?, ?> o = (ElementKey<?, ?>) obj; if (id == null) { if (o.id != null) { return false; } } else if (!id.equals(o.id)) { return false; } return elementType == o.elementType && datatype == o.datatype; }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj == null || obj.getClass() != ElementKey.class) { return false; } ElementKey<?, ?> o = (ElementKey<?, ?>) obj; if (id == null) { if (o.id != null) { return false; } } else if (!id.equals(o.id)) { return false; } return elementType == o.elementType && datatype == o.datatype; }
@Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj == null || obj.getClass() != ElementKey.class) { return false; } ElementKey<?, ?> o = (ElementKey<?, ?>) obj; if (id == null) { if (o.id != null) { return false; } } else if (!id.equals(o.id)) { return false; } return elementType == o.elementType && datatype == o.datatype; }
/** * Creates an immutable map of renamed attributes from the collection of * attribute keys. This binds the attributes and checks if they have a * different name under the context of this metadata, and returns any * attributes with an alternate name in the map. */ private ImmutableMap<QName, AttributeKey<?>> getRenamedAttributes() { Builder<QName, AttributeKey<?>> builder = ImmutableMap.builder(); for (AttributeKey<?> key : attributes.values()) { AttributeMetadata<?> bound = bindAttribute(key); QName boundName = bound.getName(); if (!boundName.equals(key.getId())) { builder.put(boundName, key); } } return builder.build(); }
/** * Creates an immutable map of renamed attributes from the collection of * attribute keys. This binds the attributes and checks if they have a * different name under the context of this metadata, and returns any * attributes with an alternate name in the map. */ private ImmutableMap<QName, AttributeKey<?>> getRenamedAttributes() { Builder<QName, AttributeKey<?>> builder = ImmutableMap.builder(); for (AttributeKey<?> key : attributes.values()) { AttributeMetadata<?> bound = bindAttribute(key); QName boundName = bound.getName(); if (!boundName.equals(key.getId())) { builder.put(boundName, key); } } return builder.build(); }
/** * Creates an immutable map of renamed child elements from the collection of * element keys. This gets the transform for each child and checks if there * is a new, different name, and if so creates a map of those new names back * to the appropriate key, for use during parsing. */ private ImmutableMap<QName, ElementKey<?, ?>> getRenamedElements() { Map<QName, ElementKey<?, ?>> renamed = Maps.newLinkedHashMap(); for (ElementKey<?, ?> key : elements.values()) { ElementTransform transform = schema.getTransform(sourceKey, key, context); QName childName = transform.getName(); if (childName != null && !childName.equals(key.getId())) { // We only use the first renamed element if multiple elements are named // the same. if (!renamed.containsKey(childName)) { renamed.put(childName, key); } } } return ImmutableMap.copyOf(renamed); }
/** * Creates an immutable map of renamed attributes from the collection of * attribute keys. This binds the attributes and checks if they have a * different name under the context of this metadata, and returns any * attributes with an alternate name in the map. */ private ImmutableMap<QName, AttributeKey<?>> getRenamedAttributes() { Builder<QName, AttributeKey<?>> builder = ImmutableMap.builder(); for (AttributeKey<?> key : attributes.values()) { AttributeMetadata<?> bound = bindAttribute(key); QName boundName = bound.getName(); if (!boundName.equals(key.getId())) { builder.put(boundName, key); } } return builder.build(); }
/** * Creates an immutable map of renamed child elements from the collection of * element keys. This gets the transform for each child and checks if there * is a new, different name, and if so creates a map of those new names back * to the appropriate key, for use during parsing. */ private ImmutableMap<QName, ElementKey<?, ?>> getRenamedElements() { Map<QName, ElementKey<?, ?>> renamed = Maps.newLinkedHashMap(); for (ElementKey<?, ?> key : elements.values()) { ElementTransform transform = schema.getTransform(sourceKey, key, context); QName childName = transform.getName(); if (childName != null && !childName.equals(key.getId())) { // We only use the first renamed element if multiple elements are named // the same. if (!renamed.containsKey(childName)) { renamed.put(childName, key); } } } return ImmutableMap.copyOf(renamed); }
@Override public boolean isDeclared(ElementKey<?, ?> key) { if (childMetadata.getKey().getId().equals(key.getId())) { return true; } return super.isDeclared(key); }
@Override public <K, L extends Element> ElementMetadata<K, L> bindElement( ElementKey<K, L> key) { // Use the provided partial metadata for any child with a matching id if (childMetadata.getKey().getId().equals(key.getId())) { @SuppressWarnings("unchecked") ElementMetadata<K, L> metadata = (ElementMetadata<K, L>) childMetadata; return metadata; } return super.bindElement(key); }
@Override public ElementKey<?, ?> findElement(QName id) { // Use the provided partial key for any child with a matching id if (childMetadata.getKey().getId().equals(id)) { return childMetadata.getKey(); } return super.findElement(id); }
/** * Merges the key from the metadata with the source key to get the "real" * key for a moved element. */ private static ElementKey<?, ?> mergeKeys(ElementKey<?, ?> sourceKey, ElementKey<?, ?> metadataKey) { if (!metadataKey.getId().equals(sourceKey.getId())) { return ElementKey.of(metadataKey.getId(), sourceKey.getDatatype(), sourceKey.getElementType()); } return sourceKey; } }
/** * Merges the key from the metadata with the source key to get the "real" * key for a moved element. */ private static ElementKey<?, ?> mergeKeys(ElementKey<?, ?> sourceKey, ElementKey<?, ?> metadataKey) { if (!metadataKey.getId().equals(sourceKey.getId())) { return ElementKey.of(metadataKey.getId(), sourceKey.getDatatype(), sourceKey.getElementType()); } return sourceKey; } }
/** * Merges the key from the metadata with the source key to get the "real" * key for a moved element. */ private static ElementKey<?, ?> mergeKeys(ElementKey<?, ?> sourceKey, ElementKey<?, ?> metadataKey) { if (!metadataKey.getId().equals(sourceKey.getId())) { return ElementKey.of(metadataKey.getId(), sourceKey.getDatatype(), sourceKey.getElementType()); } return sourceKey; } }