Class PrimitiveDatatype<AV extends PrimitiveValue>
- java.lang.Object
-
- org.ow2.authzforce.core.pdp.api.value.Datatype<AV>
-
- org.ow2.authzforce.core.pdp.api.value.PrimitiveDatatype<AV>
-
- Type Parameters:
AV
- value type
- Direct Known Subclasses:
AttributeDatatype
public class PrimitiveDatatype<AV extends PrimitiveValue> extends Datatype<AV>
Primitive datatype
-
-
Field Summary
-
Fields inherited from class org.ow2.authzforce.core.pdp.api.value.Datatype
AUTHZFORCE_EXTENSION_PREFIX
-
-
Constructor Summary
Constructors Constructor Description PrimitiveDatatype(Class<AV> instanceClass, String id, String functionIdPrefix, net.sf.saxon.s9api.ItemType xpathDatatype)
Datatype constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AV
cast(Value val)
Casts a value to the class or interface represented by this datatype.Class<AV[]>
getArrayClass()
Get class of array of instances of this datatypeClass<AV>
getInstanceClass()
Get class of instances of this datatypeOptional<Datatype<?>>
getTypeParameter()
Return type parameter e.g.boolean
isInstance(Value val)
This method returns true if the specified value argument is an instance of the represented datatype; it returns false otherwiseAV[]
newArray(int length)
Creates a new array with this as component type-
Methods inherited from class org.ow2.authzforce.core.pdp.api.value.Datatype
equals, getFunctionIdPrefix, getId, getXPathItemType, hashCode, toString
-
-
-
-
Constructor Detail
-
PrimitiveDatatype
public PrimitiveDatatype(Class<AV> instanceClass, String id, String functionIdPrefix, net.sf.saxon.s9api.ItemType xpathDatatype) throws NullPointerException
Datatype constructor- Parameters:
instanceClass
- (non-null) Java class used as implementation for this datatype, i.e. all values of this datatype are instances ofvalueClass
.id
- (non-null) datatype IDfunctionIdPrefix
- (non-null) prefix of ID of any standard generic (e.g. bag/set) function built on this datatype, e.g. 'urn:oasis:names:tc:xacml:1.0:function:string' for string datatype- Throws:
NullPointerException
- ifinstanceClass == null || id == null || functionIdPrefix == null
.
-
-
Method Detail
-
isInstance
public final boolean isInstance(Value val)
Description copied from class:Datatype
This method returns true if the specified value argument is an instance of the represented datatype; it returns false otherwise- Specified by:
isInstance
in classDatatype<AV extends PrimitiveValue>
- Parameters:
val
- value to be checked- Returns:
- true iff
val
is an instance of this datatype
-
cast
public final AV cast(Value val) throws ClassCastException
Description copied from class:Datatype
Casts a value to the class or interface represented by this datatype.- Specified by:
cast
in classDatatype<AV extends PrimitiveValue>
- Parameters:
val
- value to be cast- Returns:
- the value after casting, or null if
val
is null - Throws:
ClassCastException
- if the value is not null and is not assignable to the type V.
-
newArray
public final AV[] newArray(int length)
Description copied from class:Datatype
Creates a new array with this as component type- Specified by:
newArray
in classDatatype<AV extends PrimitiveValue>
- Parameters:
length
- length of the new array- Returns:
- the new array
-
getTypeParameter
public final Optional<Datatype<?>> getTypeParameter()
Description copied from class:Datatype
Return type parameter e.g. the bag element datatype (datatype of every element in a bag of this datatype); null if this is a primitive type (no sub-elements)- Specified by:
getTypeParameter
in classDatatype<AV extends PrimitiveValue>
- Returns:
- datatype parameter, null for primitive datatypes
-
getInstanceClass
public final Class<AV> getInstanceClass()
Get class of instances of this datatype- Returns:
- class of instances of this datatype
-
-