Oracle Application Development Framework Model and Business Components Java API Reference 10g Release 3 (10.1.3)
B16005-01


oracle.jbo.common
Class VariableImpl

java.lang.Object
  extended byoracle.jbo.common.NamedObjectImpl
      extended byoracle.jbo.common.VariableImpl

All Implemented Interfaces:
AttributeDef, AttributeHints, Properties, java.io.Serializable, ValidationManager, Variable

public class VariableImpl
extends NamedObjectImpl
implements Variable, ValidationManager, AttributeHints, java.io.Serializable
See Also:
Serialized Form

Field Summary
protected  java.lang.Object mDefaultValue
          The default value of the attribute.
protected  java.lang.Class mJavaType
          The Java Type Object for this attribute.
protected  java.lang.String mJavaTypeName
           
protected  boolean mMandatory
          Value determines whether the attribute allows null values.
protected  boolean mNotNull
          Value determines whether the attribute is null.
protected  int mPrecision
          Precision Value for the attribute, defaulted to zero.
protected  int mScale
          Scale value for attribute, set by default to 0.
protected  byte mUpdateable
          Value determines whether the attribute is updatable.

 

Fields inherited from class oracle.jbo.common.NamedObjectImpl
mFullName, mObjName, mParent, mProperties

 

Fields inherited from interface oracle.jbo.Variable
VAR_KIND_WHERE_CLAUSE_PARAM

 

Fields inherited from interface oracle.jbo.AttributeDef
ATTR_ASSOCIATED_ROW, ATTR_ASSOCIATED_ROWITERATOR, ATTR_DYNAMIC, ATTR_ENTITY_DERIVED, ATTR_PERSISTENT, ATTR_SQL_DERIVED, ATTR_TRANSIENT, ATTR_VARIABLE, READONLY, UPDATEABLE, UPDATEABLE_WHILE_NEW

 

Fields inherited from interface oracle.jbo.AttributeHints
ATTRIBUTE_CTL_DISPLAYHEIGHT, ATTRIBUTE_CTL_DISPLAYWIDTH, ATTRIBUTE_CTL_FORMTYPE, ATTRIBUTE_CTL_TYPE, ATTRIBUTE_DISPLAY_HINT, ATTRIBUTE_DISPLAY_HINT_DISPLAY, ATTRIBUTE_DISPLAY_HINT_HIDE, ATTRIBUTE_FORM_TYPE_DETAIL, ATTRIBUTE_FORM_TYPE_SHORT, ATTRIBUTE_LABEL, ATTRIBUTE_TOOLTIP, CTLTYPE_DATE, CTLTYPE_DEFAULT, CTLTYPE_EDIT, CTLTYPE_IMAGE, CTLTYPE_LIST, CTLTYPE_LOV, CTLTYPE_TOGGLE, FMT_FORMAT, FMT_FORMATTER

 

Constructor Summary
VariableImpl()
          Default constructor for this class.
VariableImpl(java.lang.String name)
           
VariableImpl(java.lang.String name, java.lang.Class javaType)
           
VariableImpl(java.lang.String name, java.lang.Object defaultValue, byte updateable, boolean notNull, java.lang.Class javaType)
           

 

Method Summary
 void addValidator(JboValidatorInterface listener)
          Add a JboValidatorInterface to the listener list.
 java.lang.Object clone()
           
 java.lang.Object convertToJava(java.lang.Object data)
          Converts a value from the database type to its corresponding Java type and returns the result.
protected  VariableImpl createClone()
           
 boolean displayInShortForm(LocaleContext locale)
          Returns true if the attribute is to displayed in the short(summary) form.
 byte getAttributeKind()
          Gets the attribute value.
 java.lang.String getColumnName()
          Overridden to return null in Variable implementations.
 java.lang.String getColumnNameForQuery()
          Overridden to return null in Variable implementations.
 int getControlType(LocaleContext locale)
          Returns the preferred control type for this attribute
 java.lang.Object getDefaultValue()
          Returns the default value of the attribute.
 int getDisplayHeight(LocaleContext locale)
          Returns the display width for this attribute
 java.lang.String getDisplayHint(LocaleContext locale)
          Retrieves the displya hint that dictates whether this attributr should be visible or not.
 int getDisplayWidth(LocaleContext locale)
          Returns the display width for this attribute
 int getElemSQLType()
          Overridden to return -1;
 java.lang.Class getElemType()
          Returns the class type for the elements if this variable stores array types.
 java.lang.Object getExtendedData()
           
 java.lang.String getFormat(LocaleContext locale)
          returns the format string stored in the ui hints
 java.lang.String getFormattedAttribute(AttributeList attrList, LocaleContext locale)
          Returns the formatted value for the attribute.
 Formatter getFormatter(LocaleContext locale)
          returns the formatter object stored in the ui hints
 java.lang.String getFormatterClassName(LocaleContext locale)
          returns the formatter object stored in the ui hints
 java.lang.String getHint(LocaleContext locale, java.lang.String sHintName)
          Return defaulted hint value
 java.lang.String getHintValue(LocaleContext locale, java.lang.String sHintName)
          Return non-defaulted hint value
 int getIndex()
          Overridden to return -1 for index.
 java.lang.Class getJavaType()
          Returns the Java type of the attribute.
 java.lang.String getJavaTypeName()
          Returns the name of the Java type of the attribute, mainly for design time.
 java.lang.String getLabel(LocaleContext locale)
          Retrieves the label to be used in any attribute prompts
 java.lang.String getLocaleName(LocaleContext locale, java.lang.String sName)
          function for retrieving the locale name of a hint
 int getPrecision()
          Gets the attribute's precision.
 int getScale()
          Gets the attribute's scale value: the number of digits to the right or left of the decimal point, depending on whether the scale value is positive or negative.
 int getSQLType()
          Overridden to return -1;
 java.lang.String getTooltip(LocaleContext locale)
          Retrives the tooltip text to be used for this attribute
 AttributeHints getUIHelper()
          return the AttributeHints interface implemented by this class
 byte getUpdateableFlag()
          Returns whether the attribute is updateable.
 java.util.ArrayList getValidators()
          Get the list of JboValidatorInterface objects registered with this attribute
 java.lang.String getVariableKind()
           
 VariableManager getVariableManager()
           
 boolean hasFormatInformation(LocaleContext locale)
          Return true if any format hints have been defined for this attribute.
 void initFromXML(DefElement xmlElement)
          *** For internal framework use only ***
 void initFromXML(DefElement xmlElement, boolean bDesignTime)
          *** For internal framework use only ***
 boolean isDefinedDefaultValue()
          Passivation uses this to tell if the current value is not the definition default.
 boolean isMandatory()
          Returns whether the attribute is not null.
 boolean isPassivationNeeded()
          The framework calls this api when building the sparse list of variables that need passivation.
 boolean isPrimaryKey()
          Overridden to return false;
 boolean isQueriable()
          Returns true for Variables that are bound as where-clause parameters
 boolean isSelected()
          Tests if an attribute is transient.
 java.lang.Object parseFormattedAttribute(java.lang.String sValue, LocaleContext locale)
          Strips off the formatting from a string and constructs an instance of the attribute's domain using the 'clean' string as a parameter of the contructor.
 void removeValidator(JboValidatorInterface listener)
          Removes a JboValidatorInterface from the listener list.
protected  java.lang.String resolveResourceProperty(java.lang.String property, LocaleContext locale)
           
 void setDefaultValue(java.lang.Object val)
           
 void setExtendedData(java.lang.Object data)
           
 void setJavaType(java.lang.Class cls)
           
 void setJavaTypeName(java.lang.String typeName)
          *** For internal framework use only ***
 void setMandatory(boolean b)
           
 void setName(java.lang.String name)
          Name this object.
 void setPrecisionScale(int prec, int scale)
          Sets the attribute's precision and scale.
 void setUpdateableFlag(byte updateable)
           
 void setVariableKind(java.lang.String kind)
           
 void setVariableManager(VariableManager manager)
           

 

Methods inherited from class oracle.jbo.common.NamedObjectImpl
getFullName, getName, getParent, getProperties, getPropertiesAsStrings, getPropertiesMap, getProperty, refreshProperty, setFullName, setParent, setPropertiesMap, setProperty

 

Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Methods inherited from interface oracle.jbo.AttributeDef
getName

 

Methods inherited from interface oracle.jbo.Properties
getProperties, getProperty, refreshProperty

 

Methods inherited from interface oracle.jbo.rules.ValidationManager
getName

 

Field Detail

mMandatory

protected boolean mMandatory
Value determines whether the attribute allows null values.

mNotNull

protected boolean mNotNull
Value determines whether the attribute is null.

mPrecision

protected int mPrecision
Precision Value for the attribute, defaulted to zero.

mScale

protected int mScale
Scale value for attribute, set by default to 0. This is the number of decimal points before/after the decimal based on whether on whether the scale if positive or negative.

mUpdateable

protected byte mUpdateable
Value determines whether the attribute is updatable.

mDefaultValue

protected java.lang.Object mDefaultValue
The default value of the attribute.

mJavaType

protected transient java.lang.Class mJavaType
The Java Type Object for this attribute.

mJavaTypeName

protected transient java.lang.String mJavaTypeName

Constructor Detail

VariableImpl

public VariableImpl()
Default constructor for this class.

VariableImpl

public VariableImpl(java.lang.String name)

VariableImpl

public VariableImpl(java.lang.String name,
                    java.lang.Class javaType)

VariableImpl

public VariableImpl(java.lang.String name,
                    java.lang.Object defaultValue,
                    byte updateable,
                    boolean notNull,
                    java.lang.Class javaType)

Method Detail

createClone

protected VariableImpl createClone()

clone

public java.lang.Object clone()
Specified by:
clone in interface Variable

setName

public void setName(java.lang.String name)
Description copied from class: NamedObjectImpl
Name this object.
Specified by:
setName in interface Variable
Overrides:
setName in class NamedObjectImpl
Parameters:
name - the name to be given to this object.

getVariableManager

public VariableManager getVariableManager()
Specified by:
getVariableManager in interface Variable

setVariableManager

public void setVariableManager(VariableManager manager)
Specified by:
setVariableManager in interface Variable

getVariableKind

public java.lang.String getVariableKind()
Specified by:
getVariableKind in interface Variable

setVariableKind

public void setVariableKind(java.lang.String kind)
Specified by:
setVariableKind in interface Variable

getExtendedData

public java.lang.Object getExtendedData()
Specified by:
getExtendedData in interface Variable

setExtendedData

public void setExtendedData(java.lang.Object data)
Specified by:
setExtendedData in interface Variable

getUpdateableFlag

public byte getUpdateableFlag()
Returns whether the attribute is updateable.
Specified by:
getUpdateableFlag in interface AttributeDef
Returns:
true if this is an editable attribute; false otherwise.

setUpdateableFlag

public void setUpdateableFlag(byte updateable)
Specified by:
setUpdateableFlag in interface Variable

isMandatory

public boolean isMandatory()
Returns whether the attribute is not null.
Specified by:
isMandatory in interface AttributeDef
Returns:
true if this is attribute not null; false otherwise.

setMandatory

public void setMandatory(boolean b)
Specified by:
setMandatory in interface Variable

getPrecision

public int getPrecision()
Gets the attribute's precision.

For strings, precision is maximum allowed length. For numeric values, precision is the number of significant digits.

Specified by:
getPrecision in interface AttributeDef
Returns:
the precision value, or 0 if unspecified.

getScale

public int getScale()
Gets the attribute's scale value: the number of digits to the right or left of the decimal point, depending on whether the scale value is positive or negative.

Scale value is meaningful only for numeric attributes.

Specified by:
getScale in interface AttributeDef
Returns:
the scale value. The default is -127.

setPrecisionScale

public void setPrecisionScale(int prec,
                              int scale)
Sets the attribute's precision and scale.

For strings, precision is maximum allowed length. For numeric values, precision is the number of significant digits.

Scale is the number of digits to the right or left of the decimal point, depending on whether the scale value is positive or negative. Scale is meaning only for numeric attributes.

Specified by:
setPrecisionScale in interface Variable
Parameters:
prec - the precision value, or 0 if unspecified.
scale - the scale value. The default is -127.

getJavaType

public java.lang.Class getJavaType()
Returns the Java type of the attribute.

For example, if the attribute is of type String, this method returns java.lang.String; if it is of type Number, it returns oracle.jbo.domain.Number.

Subclasses should override this method because Entities without accessors should also be able to get their types from attribute descriptors and beans.

Specified by:
getJavaType in interface AttributeDef
Returns:
the attribute's Java class, or Object for attributes which have no accessor methods available.

setJavaType

public void setJavaType(java.lang.Class cls)
Specified by:
setJavaType in interface Variable

getJavaTypeName

public java.lang.String getJavaTypeName()
Returns the name of the Java type of the attribute, mainly for design time.

For example, if the attribute is of type String, this method returns java.lang.String; if it is of type Number, it returns oracle.jbo.domain.Number.


setJavaTypeName

public void setJavaTypeName(java.lang.String typeName)
*** For internal framework use only ***

getDefaultValue

public java.lang.Object getDefaultValue()
Returns the default value of the attribute.

The default value for an attribute is expressed in terms of the Java type system, rather than the storage type system.

Specified by:
getDefaultValue in interface Variable
Returns:
the default value for the attribute, or null if none.

setDefaultValue

public void setDefaultValue(java.lang.Object val)
Specified by:
setDefaultValue in interface Variable

convertToJava

public java.lang.Object convertToJava(java.lang.Object data)
Converts a value from the database type to its corresponding Java type and returns the result.

This method uses AttributeDefImpl() metadata to convert a database value to the corresponding Java value.

Specified by:
convertToJava in interface Variable
Parameters:
data - a storage value to be converted.
Returns:
an object of the Java type defined for this attribute.

addValidator

public void addValidator(JboValidatorInterface listener)
Add a JboValidatorInterface to the listener list.
Specified by:
addValidator in interface ValidationManager
Parameters:
listener - The Validator to be added

getValidators

public java.util.ArrayList getValidators()
Get the list of JboValidatorInterface objects registered with this attribute
Specified by:
getValidators in interface ValidationManager
Returns:
ArrayList List of Validators

removeValidator

public void removeValidator(JboValidatorInterface listener)
Removes a JboValidatorInterface from the listener list.
Parameters:
listener - The Validator to be removed

initFromXML

public void initFromXML(DefElement xmlElement)
*** For internal framework use only ***

initFromXML

public void initFromXML(DefElement xmlElement,
                        boolean bDesignTime)
*** For internal framework use only ***

isPassivationNeeded

public boolean isPassivationNeeded()
The framework calls this api when building the sparse list of variables that need passivation.
Specified by:
isPassivationNeeded in interface Variable

isDefinedDefaultValue

public boolean isDefinedDefaultValue()
Passivation uses this to tell if the current value is not the definition default.
Specified by:
isDefinedDefaultValue in interface Variable

getUIHelper

public AttributeHints getUIHelper()
return the AttributeHints interface implemented by this class
Specified by:
getUIHelper in interface AttributeDef
See Also:
AttributeHints

getLocaleName

public java.lang.String getLocaleName(LocaleContext locale,
                                      java.lang.String sName)
Description copied from interface: AttributeHints
function for retrieving the locale name of a hint
Specified by:
getLocaleName in interface AttributeHints

resolveResourceProperty

protected java.lang.String resolveResourceProperty(java.lang.String property,
                                                   LocaleContext locale)

getLabel

public final java.lang.String getLabel(LocaleContext locale)
Retrieves the label to be used in any attribute prompts
Specified by:
getLabel in interface AttributeHints

getTooltip

public final java.lang.String getTooltip(LocaleContext locale)
Retrives the tooltip text to be used for this attribute
Specified by:
getTooltip in interface AttributeHints

getDisplayHint

public final java.lang.String getDisplayHint(LocaleContext locale)
Retrieves the displya hint that dictates whether this attributr should be visible or not. The two possible values are: ATTRIBUTE_DISPLAY_HINT_DISPLAY = "Display"; ATTRIBUTE_DISPLAY_HINT_HIDE = "Hide";
Specified by:
getDisplayHint in interface AttributeHints

getControlType

public final int getControlType(LocaleContext locale)
Returns the preferred control type for this attribute
Specified by:
getControlType in interface AttributeHints

getDisplayWidth

public final int getDisplayWidth(LocaleContext locale)
Returns the display width for this attribute
Specified by:
getDisplayWidth in interface AttributeHints

getDisplayHeight

public final int getDisplayHeight(LocaleContext locale)
Returns the display width for this attribute
Specified by:
getDisplayHeight in interface AttributeHints

getHint

public java.lang.String getHint(LocaleContext locale,
                                java.lang.String sHintName)
Return defaulted hint value
Specified by:
getHint in interface AttributeHints

getHintValue

public java.lang.String getHintValue(LocaleContext locale,
                                     java.lang.String sHintName)
Return non-defaulted hint value
Specified by:
getHintValue in interface AttributeHints

getFormat

public final java.lang.String getFormat(LocaleContext locale)
Description copied from interface: AttributeHints
returns the format string stored in the ui hints
Specified by:
getFormat in interface AttributeHints

getFormatter

public final Formatter getFormatter(LocaleContext locale)
Description copied from interface: AttributeHints
returns the formatter object stored in the ui hints
Specified by:
getFormatter in interface AttributeHints

hasFormatInformation

public final boolean hasFormatInformation(LocaleContext locale)
Description copied from interface: AttributeHints
Return true if any format hints have been defined for this attribute. This function should eb used to bracket any calls to the formatting api.
Specified by:
hasFormatInformation in interface AttributeHints

getFormattedAttribute

public final java.lang.String getFormattedAttribute(AttributeList attrList,
                                                    LocaleContext locale)
Description copied from interface: AttributeHints
Returns the formatted value for the attribute. The AttributeList parameter will usually be an instance of the oracle.jbo.Row class.
Specified by:
getFormattedAttribute in interface AttributeHints

parseFormattedAttribute

public final java.lang.Object parseFormattedAttribute(java.lang.String sValue,
                                                      LocaleContext locale)
Description copied from interface: AttributeHints
Strips off the formatting from a string and constructs an instance of the attribute's domain using the 'clean' string as a parameter of the contructor.
Specified by:
parseFormattedAttribute in interface AttributeHints

displayInShortForm

public final boolean displayInShortForm(LocaleContext locale)
Description copied from interface: AttributeHints
Returns true if the attribute is to displayed in the short(summary) form.
Specified by:
displayInShortForm in interface AttributeHints

getFormatterClassName

public final java.lang.String getFormatterClassName(LocaleContext locale)
returns the formatter object stored in the ui hints
Specified by:
getFormatterClassName in interface AttributeHints

getAttributeKind

public byte getAttributeKind()
Description copied from interface: AttributeDef
Gets the attribute value.
Specified by:
getAttributeKind in interface Variable
Returns:
ATTR_VARIABLE

getColumnName

public java.lang.String getColumnName()
Overridden to return null in Variable implementations.
Specified by:
getColumnName in interface Variable

getColumnNameForQuery

public java.lang.String getColumnNameForQuery()
Overridden to return null in Variable implementations.
Specified by:
getColumnNameForQuery in interface Variable

getSQLType

public int getSQLType()
Overridden to return -1;
Specified by:
getSQLType in interface Variable

isPrimaryKey

public boolean isPrimaryKey()
Overridden to return false;
Specified by:
isPrimaryKey in interface Variable

getElemSQLType

public int getElemSQLType()
Overridden to return -1;
Specified by:
getElemSQLType in interface Variable

getIndex

public int getIndex()
Overridden to return -1 for index.
Specified by:
getIndex in interface AttributeDef
Returns:
the index of the attribute row's definition object.

getElemType

public java.lang.Class getElemType()
Returns the class type for the elements if this variable stores array types.
Specified by:
getElemType in interface AttributeDef
Returns:
the attribute's element class, or null if the attribute is not an array attribute.

isSelected

public boolean isSelected()
Description copied from interface: AttributeDef
Tests if an attribute is transient. Transient attributes are those whose values are derived when needed. There is no mapping onto a column in a table for these values.
Specified by:
isSelected in interface AttributeDef
Returns:
true if this attribute is transient.

isQueriable

public boolean isQueriable()
Returns true for Variables that are bound as where-clause parameters
Specified by:
isQueriable in interface AttributeDef
Returns:
true if this attribute is queriable.

Oracle Application Development Framework Model and Business Components Java API Reference 10g Release 3 (10.1.3)
B16005-01


Copyright © 1997, 2005, Oracle. All rights reserved.