Package org.apache.jackrabbit.oak.api
Class Type<T>
- java.lang.Object
-
- org.apache.jackrabbit.oak.api.Type<T>
-
- Type Parameters:
T-
- All Implemented Interfaces:
java.lang.Comparable<Type<?>>
public final class Type<T> extends java.lang.Object implements java.lang.Comparable<Type<?>>
Instances of this class map Java types toproperty types. Passing an instance of this class toPropertyState.getValue(Type)determines the return type of that method.
-
-
Field Summary
Fields Modifier and Type Field Description static Type<java.lang.Iterable<Blob>>BINARIESMapIterable<Blob>to array ofPropertyType.BINARYstatic Type<Blob>BINARYMapBlobtoPropertyType.BINARYstatic Type<java.lang.Boolean>BOOLEANMapBooleantoPropertyType.BOOLEANstatic Type<java.lang.Iterable<java.lang.Boolean>>BOOLEANSMapIterable<Boolean>to array ofPropertyType.BOOLEANstatic Type<java.lang.String>DATEMapStringtoPropertyType.DATEstatic Type<java.lang.Iterable<java.lang.String>>DATESMapIterable<String>to array ofPropertyType.DATEstatic Type<java.math.BigDecimal>DECIMALMapBigDecimaltoPropertyType.DECIMALstatic Type<java.lang.Iterable<java.math.BigDecimal>>DECIMALSMapIterable<BigDecimal>to array ofPropertyType.DECIMALstatic Type<java.lang.Double>DOUBLEMapDoubletoPropertyType.DOUBLEstatic Type<java.lang.Iterable<java.lang.Double>>DOUBLESMapIterable<Double>to array ofPropertyType.DOUBLEstatic Type<java.lang.Long>LONGMapLongtoPropertyType.LONGstatic Type<java.lang.Iterable<java.lang.Long>>LONGSMapIterable<Long>to array ofPropertyType.LONGstatic Type<java.lang.String>NAMEMapStringtoPropertyType.STRINGstatic Type<java.lang.Iterable<java.lang.String>>NAMESMapIterable<String>to array ofPropertyType.NAMEstatic Type<java.lang.String>PATHMapStringtoPropertyType.PATHstatic Type<java.lang.Iterable<java.lang.String>>PATHSMapIterable<String>to array ofPropertyType.PATHstatic Type<java.lang.String>REFERENCEMapStringtoPropertyType.REFERENCEstatic Type<java.lang.Iterable<java.lang.String>>REFERENCESMapIterable<String>to array ofPropertyType.REFERENCEstatic Type<java.lang.String>STRINGMapStringtoPropertyType.STRINGstatic Type<java.lang.Iterable<java.lang.String>>STRINGSMapIterable<String>to array ofPropertyType.STRINGstatic Type<java.lang.Void>UNDEFINEDThe special "undefined" type, never encountered in normal valuesstatic Type<java.lang.Iterable<java.lang.Void>>UNDEFINEDSMulti-valued "undefined" type, never encountered in normal valuesstatic Type<java.lang.String>URIMapStringtoPropertyType.URIstatic Type<java.lang.Iterable<java.lang.String>>URISMapIterable<String>to array ofPropertyType.URIstatic Type<java.lang.String>WEAKREFERENCEMapStringtoPropertyType.WEAKREFERENCEstatic Type<java.lang.Iterable<java.lang.String>>WEAKREFERENCESMapIterable<String>to array ofPropertyType.WEAKREFERENCE
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(@NotNull Type<?> that)booleanequals(java.lang.Object other)static Type<?>fromString(java.lang.String string)Returns theTypewith the given string representation.static Type<?>fromTag(int tag, boolean array)CorrespondingTypefor a given type tag and array flag.Type<?>getArrayType()Determine the array type which has this type as base typeType<?>getBaseType()Determine the base type of array typesinthashCode()booleanisArray()Determine whether this is an array typeinttag()Corresponding type tag as defined inPropertyType.java.lang.StringtoString()
-
-
-
Field Detail
-
STRING
public static final Type<java.lang.String> STRING
MapStringtoPropertyType.STRING
-
BINARY
public static final Type<Blob> BINARY
MapBlobtoPropertyType.BINARY
-
LONG
public static final Type<java.lang.Long> LONG
MapLongtoPropertyType.LONG
-
DOUBLE
public static final Type<java.lang.Double> DOUBLE
MapDoubletoPropertyType.DOUBLE
-
DATE
public static final Type<java.lang.String> DATE
MapStringtoPropertyType.DATE
-
BOOLEAN
public static final Type<java.lang.Boolean> BOOLEAN
MapBooleantoPropertyType.BOOLEAN
-
NAME
public static final Type<java.lang.String> NAME
MapStringtoPropertyType.STRING
-
PATH
public static final Type<java.lang.String> PATH
MapStringtoPropertyType.PATH
-
REFERENCE
public static final Type<java.lang.String> REFERENCE
MapStringtoPropertyType.REFERENCE
-
WEAKREFERENCE
public static final Type<java.lang.String> WEAKREFERENCE
MapStringtoPropertyType.WEAKREFERENCE
-
URI
public static final Type<java.lang.String> URI
MapStringtoPropertyType.URI
-
DECIMAL
public static final Type<java.math.BigDecimal> DECIMAL
MapBigDecimaltoPropertyType.DECIMAL
-
STRINGS
public static final Type<java.lang.Iterable<java.lang.String>> STRINGS
MapIterable<String>to array ofPropertyType.STRING
-
BINARIES
public static final Type<java.lang.Iterable<Blob>> BINARIES
MapIterable<Blob>to array ofPropertyType.BINARY
-
LONGS
public static final Type<java.lang.Iterable<java.lang.Long>> LONGS
MapIterable<Long>to array ofPropertyType.LONG
-
DOUBLES
public static final Type<java.lang.Iterable<java.lang.Double>> DOUBLES
MapIterable<Double>to array ofPropertyType.DOUBLE
-
DATES
public static final Type<java.lang.Iterable<java.lang.String>> DATES
MapIterable<String>to array ofPropertyType.DATE
-
BOOLEANS
public static final Type<java.lang.Iterable<java.lang.Boolean>> BOOLEANS
MapIterable<Boolean>to array ofPropertyType.BOOLEAN
-
NAMES
public static final Type<java.lang.Iterable<java.lang.String>> NAMES
MapIterable<String>to array ofPropertyType.NAME
-
PATHS
public static final Type<java.lang.Iterable<java.lang.String>> PATHS
MapIterable<String>to array ofPropertyType.PATH
-
REFERENCES
public static final Type<java.lang.Iterable<java.lang.String>> REFERENCES
MapIterable<String>to array ofPropertyType.REFERENCE
-
WEAKREFERENCES
public static final Type<java.lang.Iterable<java.lang.String>> WEAKREFERENCES
MapIterable<String>to array ofPropertyType.WEAKREFERENCE
-
URIS
public static final Type<java.lang.Iterable<java.lang.String>> URIS
MapIterable<String>to array ofPropertyType.URI
-
DECIMALS
public static final Type<java.lang.Iterable<java.math.BigDecimal>> DECIMALS
MapIterable<BigDecimal>to array ofPropertyType.DECIMAL
-
UNDEFINED
public static final Type<java.lang.Void> UNDEFINED
The special "undefined" type, never encountered in normal values
-
UNDEFINEDS
public static final Type<java.lang.Iterable<java.lang.Void>> UNDEFINEDS
Multi-valued "undefined" type, never encountered in normal values
-
-
Method Detail
-
tag
public int tag()
Corresponding type tag as defined inPropertyType.- Returns:
- type tag
-
isArray
public boolean isArray()
Determine whether this is an array type- Returns:
trueif and only if this is an array type
-
fromTag
public static Type<?> fromTag(int tag, boolean array)
CorrespondingTypefor a given type tag and array flag.- Parameters:
tag- type tag as defined inPropertyType.array- whether this is an array or not- Returns:
Typeinstance- Throws:
java.lang.IllegalArgumentException- if tag is not valid as per definition inPropertyType.
-
fromString
public static Type<?> fromString(java.lang.String string)
Returns theTypewith the given string representation.- Parameters:
string- type string- Returns:
- matching type
-
getBaseType
public Type<?> getBaseType()
Determine the base type of array types- Returns:
- base type
- Throws:
java.lang.IllegalStateException- ifisArrayis false.
-
getArrayType
public Type<?> getArrayType()
Determine the array type which has this type as base type- Returns:
- array type with this type as base type
- Throws:
java.lang.IllegalStateException- ifisArrayis true.
-
compareTo
public int compareTo(@NotNull @NotNull Type<?> that)- Specified by:
compareToin interfacejava.lang.Comparable<T>
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object other)
- Overrides:
equalsin classjava.lang.Object
-
-