ThinkUI SQL Client 1.1.3 API

thinkui.db.attribute
Interface AttributeType

All Superinterfaces:
java.lang.Comparable, java.util.Comparator, java.io.Serializable

public interface AttributeType
extends java.util.Comparator, java.io.Serializable, java.lang.Comparable

Defines the interface for all attribute types. The common characteristic of an attribute type is that:


Field Summary
static AttributeType[] ALL_TYPES
           
static AttributeType BIG_DECIMAL
           
static AttributeType BIG_INTEGER
           
static AttributeType BINARY
           
static AttributeType BLOB
           
static AttributeType BOOLEAN
           
static AttributeType BYTE
           
static AttributeType CHARACTER
           
static AttributeType CLOB
           
static AttributeType DATA_OBJECT
           
static AttributeType DATE
           
static AttributeType DATETIME
           
static AttributeType DIR_NAME
           
static AttributeType DOUBLE
           
static AttributeType EMAIL_ADDRESS
           
static AttributeType FILE_NAME
           
static AttributeType FLOAT
           
static AttributeType IN_SET_SEARCH_CRITERIA
           
static AttributeType INTEGER
           
static AttributeType LONG
           
static AttributeType LONG_BINARY
           
static AttributeType OBJECT_ID
           
static AttributeType PASSWORD
           
static AttributeType RESULT_SET
           
static AttributeType SERIALIZABLE
           
static AttributeType SHORT
           
static AttributeType STRING
           
static AttributeType TEXT
           
static AttributeType TIME
           
static AttributeType TIMESTAMP
           
static AttributeType URL
           
static AttributeType USER_DEFINED
           
static AttributeType YN_CHARACTER
           
 
Method Summary
 int compare(java.lang.Object o1, java.lang.Object o2)
          Compare two values of this attribute type.
 java.lang.Object convert(java.lang.String stringValue)
          Convert the value formatted as a String back to the underlying value for this attribute type.
 java.lang.Object decode(java.lang.String encodedValue)
          Decode the value for this attribute type that was previously encoded with the encode() method.
 java.lang.String display(java.lang.Object value)
          Format the value for this attribute type for display purposes.
 java.lang.String encode(java.lang.Object value)
          Encode the value for this attribute type.
 java.lang.String format(java.lang.Object value)
          Format the value for this attribute type as a String based on the format description returned by the getFormat() method.
 java.lang.String getFormat()
          Returns the format description string for this attribute type.
 int getMaxChars()
          Returns the maximum number of characters required to represent the largest value of this attribute type.
 java.lang.String getName()
          Returns the name of the attribute type.
 java.lang.String getRegexFilter()
          Returns the regular expression that can be used to filter character input for the type.
 java.lang.String getRegexPattern()
          Returns the regular expression that can be used to validate the input for the type (typically of type String).
 java.lang.Class getValueClass()
          Returns the Java class of values of this attribute type.
 java.lang.Object getZeroValue()
           
 void validate(java.lang.Object value)
          Validate the value for this attribute type.
 
Methods inherited from interface java.util.Comparator
equals
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Field Detail

ALL_TYPES

public static final AttributeType[] ALL_TYPES

BIG_DECIMAL

public static final AttributeType BIG_DECIMAL

BIG_INTEGER

public static final AttributeType BIG_INTEGER

BINARY

public static final AttributeType BINARY

BLOB

public static final AttributeType BLOB

BOOLEAN

public static final AttributeType BOOLEAN

BYTE

public static final AttributeType BYTE

CHARACTER

public static final AttributeType CHARACTER

CLOB

public static final AttributeType CLOB

DATA_OBJECT

public static final AttributeType DATA_OBJECT

DATE

public static final AttributeType DATE

DATETIME

public static final AttributeType DATETIME

DIR_NAME

public static final AttributeType DIR_NAME

DOUBLE

public static final AttributeType DOUBLE

EMAIL_ADDRESS

public static final AttributeType EMAIL_ADDRESS

FILE_NAME

public static final AttributeType FILE_NAME

FLOAT

public static final AttributeType FLOAT

IN_SET_SEARCH_CRITERIA

public static final AttributeType IN_SET_SEARCH_CRITERIA

INTEGER

public static final AttributeType INTEGER

LONG

public static final AttributeType LONG

LONG_BINARY

public static final AttributeType LONG_BINARY

OBJECT_ID

public static final AttributeType OBJECT_ID

PASSWORD

public static final AttributeType PASSWORD

RESULT_SET

public static final AttributeType RESULT_SET

SERIALIZABLE

public static final AttributeType SERIALIZABLE

SHORT

public static final AttributeType SHORT

STRING

public static final AttributeType STRING

TEXT

public static final AttributeType TEXT

TIME

public static final AttributeType TIME

TIMESTAMP

public static final AttributeType TIMESTAMP

URL

public static final AttributeType URL

USER_DEFINED

public static final AttributeType USER_DEFINED

YN_CHARACTER

public static final AttributeType YN_CHARACTER
Method Detail

compare

public int compare(java.lang.Object o1,
                   java.lang.Object o2)
Compare two values of this attribute type.

Specified by:
compare in interface java.util.Comparator

convert

public java.lang.Object convert(java.lang.String stringValue)
                         throws java.lang.Exception
Convert the value formatted as a String back to the underlying value for this attribute type.

Throws:
java.lang.Exception

decode

public java.lang.Object decode(java.lang.String encodedValue)
                        throws java.lang.Exception
Decode the value for this attribute type that was previously encoded with the encode() method.

Throws:
java.lang.Exception

display

public java.lang.String display(java.lang.Object value)
Format the value for this attribute type for display purposes. Typically the display() method returns the same value as the format() method. However, for some attribute types, the display() value will be completely different. The display value is intended to be used in non-editable fields.


encode

public java.lang.String encode(java.lang.Object value)
                        throws java.lang.Exception
Encode the value for this attribute type. The encoded value will be suitable for transmission (e.g. in a HTTP URL) or persisting to a file. The encoded String should be alpha-numeric and should be limited to the standard base 64 characters set.

Throws:
java.lang.Exception

format

public java.lang.String format(java.lang.Object value)
Format the value for this attribute type as a String based on the format description returned by the getFormat() method. Where possible, this string should be user understandable and be suitable for user data entry. To convert the returned String back to the underlying value use the convert() method.


getFormat

public java.lang.String getFormat()
Returns the format description string for this attribute type. The format string provides a user understandable description of the format of the values for the attribute type. If no description format is applicable then null is returned.

Returns:
the format string for this attribute type or null.

getMaxChars

public int getMaxChars()
Returns the maximum number of characters required to represent the largest value of this attribute type. The String length of any return value of the format() method is guaranteed not to exceed this maximum value. If the attribute type does not have an inherent maximum width (e.g. StringType), -1 is returned.


getName

public java.lang.String getName()
Returns the name of the attribute type. For user defined types, the name is the underlying Java class name.

Returns:
the name of the attribute type.

getRegexFilter

public java.lang.String getRegexFilter()
Returns the regular expression that can be used to filter character input for the type. The regular expression specified will be evaluated for each edit on the value (i.e. insert/replace actions). If the edit does not conform to the regular expression, the edit will be prevented. As such, the regular expression should typically only contain set of characters to be included and/or excluded. It should not typically specify a pattern where sequence is important.

Returns:
the regular expression filter for this attribute type or null.

getRegexPattern

public java.lang.String getRegexPattern()
Returns the regular expression that can be used to validate the input for the type (typically of type String). The regular expression will be used to validate a value after it has been entered. To specify a regular expression to filter characters during data entry, use the getRegexFilter() method.

Returns:
the regular expression pattern for this attribute type or null.

getValueClass

public java.lang.Class getValueClass()
Returns the Java class of values of this attribute type. For user defined types, this Java class will correspond to the class name return by the getName() method. If the class could not be loaded, the Object class is returned instead.

Returns:
the Java class of values of this attribute type.

getZeroValue

public java.lang.Object getZeroValue()
Returns:
the "zero" value for the attribute type or null.

validate

public void validate(java.lang.Object value)
              throws java.lang.Exception
Validate the value for this attribute type.

Throws:
java.lang.Exception

ThinkUI SQL Client 1.1.3 API

Copyright © 2007-2009. ThinkUI Software Inc. All rights reserved.