D
- the datatype of the elementE
- the element type of the elementpublic final class ElementKey<D,E extends Element> extends MetadataKey<D>
equals(Object)
to another element key if their
IDs are equivalent or both null
, and their datatypes, and element
types are the same.matches(MetadataKey)
another element key if the
ID is a match for the ID of the other key, and the datatype and element type
are both assignable from the other key's datatype and element type.Modifier and Type | Method and Description |
---|---|
int |
compareTo(MetadataKey<?> other)
Compares first on ID, then on element type, then on datatype.
|
boolean |
equals(java.lang.Object obj) |
java.lang.Class<? extends E> |
getElementType()
Returns the element type of the element.
|
int |
hashCode() |
boolean |
matches(MetadataKey<?> other)
Returns
true if this key is a match for the given key. |
static ElementKey<java.lang.String,Element> |
of(QName id)
Return a default element key using a string datatype and
Element as the element type. |
static <T,V extends Element> |
of(QName id,
java.lang.Class<? extends T> datatype,
java.lang.Class<? extends V> elementType)
Construct an element key with the given id, datatype, and element type.
|
static <V extends Element> |
of(QName id,
java.lang.Class<? extends V> elementType)
Construct an element key with the given id and element type, but with
a
Void datatype. |
java.lang.String |
toString() |
getDatatype, getId
public static ElementKey<java.lang.String,Element> of(QName id)
Element
as the element type. The id must not be null
.public static <V extends Element> ElementKey<java.lang.Void,V> of(QName id, java.lang.Class<? extends V> elementType)
Void
datatype. This is used for elements without text content.
The elementType
must not be null
. A null id is only
valid for element types that are a subclass of Element
, and are
used as a key referring to all instances of that element type.
public static <T,V extends Element> ElementKey<T,V> of(QName id, java.lang.Class<? extends T> datatype, java.lang.Class<? extends V> elementType)
The elementType
must not be null
. A null id is only
valid for element types that are a subclass of Element
, and are
used as a key referring to all instances of that element type.
public java.lang.Class<? extends E> getElementType()
public boolean matches(MetadataKey<?> other)
true
if this key is a match for the given key. This key is
a match for the other key if the other key is also an element key and if
the ID, datatype, and element types all match.matches
in class MetadataKey<D>
public int compareTo(MetadataKey<?> other)
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public java.lang.String toString()
toString
in class MetadataKey<D>