Vordel SDK

com.vordel.es
Class FieldType

java.lang.Object
  extended by com.vordel.es.FieldType
Direct Known Subclasses:
ConstantFieldType

public class FieldType
extends java.lang.Object

A FieldType defines the type of a specific Field for a given EntityType. Fields can be one of several primitive types, or a reference type which is further specified by the EntityType of the Entity to which it refers. For example, a Field of FieldType '@Book' is a field which stores an ESPK referencing an Entity of type 'Book'.

The FieldType will also define the cardinality of a field's values, which can be:


Field Summary
static java.lang.String BINARY
          Base64 Encoded bytes
static java.lang.String BOOLEAN
          Primitive Type Boolean.
protected  java.util.List<Value> defaultValues
           
static java.lang.String ENCRYPTED
          New type for VS 4.1 Semantically, the encrypted type is the same as the binary type, i.e.
static java.lang.String INTEGER
          Interpreted as a Java 'int' primitive type.
static java.lang.String LONG
          Interpreted as a Java 'long' primitive type.
static java.lang.Integer ONE
          Constant declaration of cardinality 1 as an object.
static char REF_DELIMITER
          Indicator that this field's values refer to another Entity via an ESPK
protected  java.lang.String reftype
           
static char SOFT_REF_DELIMITER
          Indicator that this Field's values refer to another Entity in another EntityStore, and must be resolved via a portable key.
static java.lang.String STRING
          Java String.
protected  java.lang.String type
          The type name: primitive string or "@EntityTypeName"
static java.lang.String UTCTIME
          Don't use - use 'long' instead.
 
Constructor Summary
protected FieldType(java.lang.String type, java.lang.Object cardinality, java.util.List<Value> defaultValues)
          Create a field type definition.
 
Method Summary
 boolean equals(java.lang.Object other)
           
 java.lang.Object getCardinality()
          Get the cardinality of this FieldType definition.
 java.lang.String getDefault()
          Get the default value for the Field.
 java.util.List<java.lang.String> getDefaults()
          Get the default values for the Field.
 java.util.List<Value> getDefaultValues()
          Get the actual default 'Value' object.
 int getMaxValueCount()
          Get the maximum number of permitted values for this field
 int getMinValueCount()
          Get the minimum number of permitted values for this field
 java.lang.String getRefType()
          If this is a reference type, get the name of the EntityType which this FieldType references.
 java.lang.String getType()
          Get the primitive type of this field or the reference type if it's an ESPK reference-type field, as it appears in the XML definition.
 boolean isNumeric()
           
 boolean isRefType()
          Determine if this type represents a reference type(for ESPKs)
 boolean isSoftRefType()
          Determine if this type represents a soft reference to an Entity via a portable ESPK
static boolean isValidPrimitiveType(java.lang.String type)
          Convenience method to decide if the primitive type is supported by the framework.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

BOOLEAN

public static final java.lang.String BOOLEAN
Primitive Type Boolean. Canonically 'true' or 'false' but in practice has been expanded to include more traditional flavors such as 1/0, yes/no etc. >:(

See Also:
Constant Field Values

STRING

public static final java.lang.String STRING
Java String. Should be UTF-8 encoded where appropriate.

See Also:
Constant Field Values

INTEGER

public static final java.lang.String INTEGER
Interpreted as a Java 'int' primitive type.

See Also:
Constant Field Values

LONG

public static final java.lang.String LONG
Interpreted as a Java 'long' primitive type.

See Also:
Constant Field Values

UTCTIME

public static final java.lang.String UTCTIME
Don't use - use 'long' instead.

See Also:
Constant Field Values

BINARY

public static final java.lang.String BINARY
Base64 Encoded bytes

See Also:
Constant Field Values

ENCRYPTED

public static final java.lang.String ENCRYPTED
New type for VS 4.1 Semantically, the encrypted type is the same as the binary type, i.e. should be a base64 encoded set of bytes which represent some encrypted content. The type of the decrypted content is not recorded at the entity store level, and is left for the application layer to interpret.

See Also:
Constant Field Values

ONE

public static final java.lang.Integer ONE
Constant declaration of cardinality 1 as an object.


REF_DELIMITER

public static final char REF_DELIMITER
Indicator that this field's values refer to another Entity via an ESPK

See Also:
Constant Field Values

SOFT_REF_DELIMITER

public static final char SOFT_REF_DELIMITER
Indicator that this Field's values refer to another Entity in another EntityStore, and must be resolved via a portable key.

See Also:
Constant Field Values

type

protected java.lang.String type
The type name: primitive string or "@EntityTypeName"


defaultValues

protected java.util.List<Value> defaultValues

reftype

protected java.lang.String reftype
Constructor Detail

FieldType

protected FieldType(java.lang.String type,
                    java.lang.Object cardinality,
                    java.util.List<Value> defaultValues)
             throws java.lang.IllegalArgumentException
Create a field type definition.

Parameters:
type - The type of the field
cardinality - The number of values allowed for this field
defaultValues - A list of default values for the field
Throws:
java.lang.IllegalArgumentException - If the type defined is not one of the primitive types
Method Detail

isValidPrimitiveType

public static boolean isValidPrimitiveType(java.lang.String type)
Convenience method to decide if the primitive type is supported by the framework.


isNumeric

public boolean isNumeric()

equals

public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object

getType

public java.lang.String getType()
Get the primitive type of this field or the reference type if it's an ESPK reference-type field, as it appears in the XML definition.

Returns:
a string representation of the basic type (primitive, reference or soft reference)

getRefType

public java.lang.String getRefType()
If this is a reference type, get the name of the EntityType which this FieldType references.

Returns:
The EntityType name of the referencing field.

getCardinality

public java.lang.Object getCardinality()
Get the cardinality of this FieldType definition.

Returns:
An Object representing the cardinality. Will be an Integer value in the specific numerical case, or a string representing the multiple valid count case.

getDefault

public java.lang.String getDefault()
Get the default value for the Field. Note that although a FieldType can now have >1 default values, this is only definable for reference types. Leaving this method here until primitive values can also have multiple values, at which time this method will become deprecated.

Returns:
The default value as a string, or ESPK if its a reference type, or null if the default reference is the NULL ESPK.

getDefaults

public java.util.List<java.lang.String> getDefaults()
Get the default values for the Field.

Returns:
The default values as a list of strings. If the field is of type 'reference' then the ESPKs are stringified. If the reference is the NULL ESPK, then a null string is returned in that place in the list.

getDefaultValues

public java.util.List<Value> getDefaultValues()
Get the actual default 'Value' object.

Returns:
the default Value list, or null if none set.

isRefType

public boolean isRefType()
Determine if this type represents a reference type(for ESPKs)

Returns:
true if Value is ESPK, false otherwise

isSoftRefType

public boolean isSoftRefType()
Determine if this type represents a soft reference to an Entity via a portable ESPK

Returns:
true if the Value is a PortableESPK, false otherwise

getMaxValueCount

public int getMaxValueCount()
Get the maximum number of permitted values for this field

Returns:
an int > 0, or -1 if there's no upper limit

getMinValueCount

public int getMinValueCount()
Get the minimum number of permitted values for this field

Returns:
an int >= 0

Vordel SDK


This documentation and all its contents and graphics, copyright © 1999 - 2011 Vordel