issrg.pba.rbac.xmlpolicy.ifstatement
Class Types

java.lang.Object
  extended by issrg.pba.rbac.xmlpolicy.ifstatement.Types

public final class Types
extends java.lang.Object

This class maintains a registry of known types, so that the string encoding of the values of these types can be decoded from the XML Policy. When registering the type, the impelementing class should have a constructor with a single String parameter to it.

By default there are three types known: BOOLEAN_TYPE, INTEGER_TYPE and STRING_TYPE ("Boolean", "Integer" and "String" respectively).

Author:
A.Otenko

Field Summary
static java.lang.String BOOLEAN_TYPE
           
static java.lang.String DOUBLE_TYPE
           
static java.lang.String INTEGER_TYPE
           
protected static java.util.Map knownTypes
           
static java.lang.String STRING_TYPE
           
 
Constructor Summary
Types()
           
 
Method Summary
static java.lang.Object construct(java.lang.String type, java.lang.String value)
          This is the method for building the objects of known types out of their String encoding.
static void registerType(java.lang.String type, java.lang.Class c)
          This method registers a class to be used to instantiate values of the given type from String encoding.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

knownTypes

protected static final java.util.Map knownTypes

INTEGER_TYPE

public static final java.lang.String INTEGER_TYPE
See Also:
Constant Field Values

DOUBLE_TYPE

public static final java.lang.String DOUBLE_TYPE
See Also:
Constant Field Values

BOOLEAN_TYPE

public static final java.lang.String BOOLEAN_TYPE
See Also:
Constant Field Values

STRING_TYPE

public static final java.lang.String STRING_TYPE
See Also:
Constant Field Values
Constructor Detail

Types

public Types()
Method Detail

registerType

public static void registerType(java.lang.String type,
                                java.lang.Class c)
This method registers a class to be used to instantiate values of the given type from String encoding.

Parameters:
type - - the type of the value
c - - the Class that represents the values of that type; it must have a public constructor with a single String argument

construct

public static java.lang.Object construct(java.lang.String type,
                                         java.lang.String value)
                                  throws EvaluationException
This is the method for building the objects of known types out of their String encoding.

Parameters:
type - is the type of the object, as it appears in the XML Policy
value - is the String encoding of the object
Returns:
the constructed type-specific Object
Throws:
EvaluationException - if the constructor is not found or the value is not properly encoded