public final class MetadataContext extends java.lang.Object implements java.lang.Comparable<MetadataContext>
This class also contains static initializers for the transforms required by each of our alt formats, which guarantees they will be loaded. We may want to put them somewhere else, but we need to move the constants for the contexts along with them.
Modifier and Type | Field and Description |
---|---|
static MetadataContext |
ATOM
The ATOM metadata context.
|
static MetadataContext |
RSS
The RSS metadata context.
|
Modifier and Type | Method and Description |
---|---|
int |
compareTo(MetadataContext other)
Compare two context objects to order them.
|
boolean |
equals(java.lang.Object obj)
Checks that the other object is a metadata context with the same alt type
and version.
|
static MetadataContext |
forAlt(AltFormat format)
Creates a new immutable metadata context with just an alt format.
|
static MetadataContext |
forContext(AltFormat format,
java.lang.String projection,
Version version)
Creates a new immutable metadata context.
|
static MetadataContext |
forProjection(java.lang.String projection)
Creates a new immutable metadata context with just projection.
|
static MetadataContext |
forVersion(Version version)
Constructs a new immutable metadata context with just version.
|
AltFormat |
getAltFormat()
The alt format the context represents.
|
java.lang.String |
getProjection()
The projection the context represents.
|
Version |
getVersion()
The version the context represents.
|
int |
hashCode()
The hashCode for a context is just the hashcode of its parts.
|
boolean |
matches(MetadataContext other)
Returns true if this context is a match for the given context.
|
java.lang.String |
toString() |
public static final MetadataContext ATOM
public static final MetadataContext RSS
public static MetadataContext forAlt(AltFormat format)
format
- the alt format for the context, not null
.public static MetadataContext forProjection(java.lang.String projection)
projection
- the projection of the context.public static MetadataContext forVersion(Version version)
version
- the version of the context.public static MetadataContext forContext(AltFormat format, java.lang.String projection, Version version)
format
- the alt format of the context.projection
- the projection for the context.version
- the version of the context.public boolean matches(MetadataContext other)
public AltFormat getAltFormat()
public java.lang.String getProjection()
public Version getVersion()
public int compareTo(MetadataContext other)
null
a NullPointerException
will be thrown.compareTo
in interface java.lang.Comparable<MetadataContext>
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 java.lang.Object