Class Datatype<V extends Value>
- java.lang.Object
-
- org.ow2.authzforce.core.pdp.api.value.Datatype<V>
-
- Type Parameters:
V
- Java value type
- Direct Known Subclasses:
BagDatatype
,PrimitiveDatatype
public abstract class Datatype<V extends Value> extends Object
Expression evaluation return type (private/package-visible-only constructors are there to make sure only derived classesPrimitiveDatatype
andBagDatatype
may be instantiated.)
-
-
Field Summary
Fields Modifier and Type Field Description static String
AUTHZFORCE_EXTENSION_PREFIX
Prefix used by AuthZForce non-standard datatypes (PDP extensions).
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract V
cast(Value val)
Casts a value to the class or interface represented by this datatype.boolean
equals(Object obj)
String
getFunctionIdPrefix()
Gets prefix of ID of any standard generic (e.g.String
getId()
Get ID (URI) of this datatypeabstract Optional<? extends Datatype<?>>
getTypeParameter()
Return type parameter e.g.int
hashCode()
abstract boolean
isInstance(Value val)
This method returns true if the specified value argument is an instance of the represented datatype; it returns false otherwiseabstract V[]
newArray(int length)
Creates a new array with this as component typeString
toString()
-
-
-
Field Detail
-
AUTHZFORCE_EXTENSION_PREFIX
public static final String AUTHZFORCE_EXTENSION_PREFIX
Prefix used by AuthZForce non-standard datatypes (PDP extensions). Third-party (outside AuthZForce project) contributions must use a different prefix to avoid conflicts.- See Also:
- Constant Field Values
-
-
Method Detail
-
getId
public final String getId()
Get ID (URI) of this datatype- Returns:
- datatype ID
-
getFunctionIdPrefix
public final String getFunctionIdPrefix()
Gets 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- Returns:
- ID prefix for functions of this datatype
-
getTypeParameter
public abstract Optional<? extends Datatype<?>> getTypeParameter()
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)- Returns:
- datatype parameter, null for primitive datatypes
-
isInstance
public abstract boolean isInstance(Value val)
This method returns true if the specified value argument is an instance of the represented datatype; it returns false otherwise- Parameters:
val
- value to be checked- Returns:
- true iff
val
is an instance of this datatype
-
cast
public abstract V cast(Value val) throws ClassCastException
Casts a value to the class or interface represented by this datatype.- 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 abstract V[] newArray(int length)
Creates a new array with this as component type- Parameters:
length
- length of the new array- Returns:
- the new array
-
-