|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object blackboard.data.BbAttributes
public class BbAttributes
The BbAttributes
class is used to store a set of BbAttribute
objects.
Constructor Summary | |
---|---|
BbAttributes()
Default Constructor |
Method Summary | |
---|---|
void |
addBbAttribute(BbAttribute theAttrib)
Deprecated. use the setType methods instead |
java.lang.Object |
clone()
This method clones the BbAttributes object, as well as creating new instances of the contained BbAttribute objects. |
BbAttribute |
getBbAttribute(java.lang.String strName)
Returns the BbAttribute object associated with given name ("key"). |
java.util.List |
getBbAttributeList()
Returns a list of the contained BbAttribute values. |
BbEnum |
getBbEnum(java.lang.String strName)
Get the BbEnum value associated with given attribute name. |
IBbObject |
getBbObject(java.lang.String strName)
Get the IBbObject value associated with given attribute name. |
java.lang.Boolean |
getBoolean(java.lang.String strName)
Get the Boolean value associated with given attribute name. |
java.util.Calendar |
getCalendar(java.lang.String strName)
Get the Calendar value associated with given attribute name. |
java.lang.Double |
getDouble(java.lang.String strName)
Get the Double value associated with given attribute name. |
java.lang.Float |
getFloat(java.lang.String strName)
Get the Float value associated with given attribute name. |
FormattedText |
getFormattedText(java.lang.String strName)
Get the FormattedText value associated with given attribute name. |
Id |
getId(java.lang.String strName)
Get the Id value associated with given attribute name. |
java.lang.Integer |
getInteger(java.lang.String strName)
Get the Integer value associated with given attribute name. |
boolean |
getIsDirty()
Get the "dirty" status of this BbAttributes . |
java.lang.Long |
getLong(java.lang.String strName)
Get the Long value associated with given attribute name. |
java.lang.Object |
getObject(java.lang.String strName)
Get the Object value associated with given attribute name. |
java.lang.Boolean |
getSafeBoolean(java.lang.String strName)
Get the Boolean value associated with given attribute name. |
java.lang.Double |
getSafeDouble(java.lang.String strName)
Get the Double value associated with given attribute name. |
java.lang.Float |
getSafeFloat(java.lang.String strName)
Get the Float value associated with given attribute name. |
FormattedText |
getSafeFormattedText(java.lang.String strName)
Get the FormattedText value associated with given attribute name. |
Id |
getSafeId(java.lang.String strName)
Get the Id value associated with given attribute name. |
java.lang.Integer |
getSafeInteger(java.lang.String strName)
Get the Integer value associated with given attribute name. |
java.lang.Long |
getSafeLong(java.lang.String strName)
Get the Long value associated with given attribute name. |
java.lang.String |
getSafeString(java.lang.String strName)
Get the String value associated with given attribute name. |
java.lang.String |
getString(java.lang.String strName)
Get the String value associated with given attribute name. |
protected java.lang.Object |
getValue(java.lang.String strName,
BbAttribute.Type eType)
Internal convenience method to make the type-specific "get" routines much simpler (i.e., shorter). |
void |
removeBbAttribute(java.lang.String strName)
Removes the BbAttribute object associated with the given name ("key") |
void |
reset()
Clears "isSet" and "isDirty" status of this BbAttributes |
void |
setBbEnum(java.lang.String strName,
BbEnum val)
Sets the value of the attribute with the given name ("key") to the provided BbEnum value. |
void |
setBbObject(java.lang.String strName)
Sets the value of the attribute with the given name ("key") to the "unset" value. |
void |
setBbObject(java.lang.String strName,
IBbObject val)
Sets the value of the attribute with the given name ("key") to the provided IBbObject value. |
void |
setBoolean(java.lang.String strName,
boolean val)
Sets the value of the attribute with the given name ("key") to the provided boolean value. |
void |
setBoolean(java.lang.String strName,
java.lang.Boolean val)
Sets the value of the attribute with the given name ("key") to the provided Boolean value. |
void |
setCalendar(java.lang.String strName,
java.util.Calendar val)
Sets the value of the attribute with the given name ("key") to the provided Calendar value. |
void |
setDouble(java.lang.String strName,
double val)
Sets the value of the attribute with the given name ("key") to the provided double value. |
void |
setDouble(java.lang.String strName,
java.lang.Double val)
Sets the value of the attribute with the given name ("key") to the provided Double value. |
void |
setFloat(java.lang.String strName,
float val)
Sets the value of the attribute with the given name ("key") to the provided float value. |
void |
setFloat(java.lang.String strName,
java.lang.Float val)
Sets the value of the attribute with the given name ("key") to the provided Float value. |
void |
setFormattedText(java.lang.String strName,
FormattedText val)
Sets the value of the attribute with the given name ("key") to the provided FormattedText value. |
void |
setId(java.lang.String strName,
Id val)
Sets the value of the attribute with the given name ("key") to the provided Id value. |
void |
setInteger(java.lang.String strName,
int val)
Sets the value of the attribute with the given name ("key") to the provided int value. |
void |
setInteger(java.lang.String strName,
java.lang.Integer val)
Sets the value of the attribute with the given name ("key") to the provided Integer value. |
void |
setIsDirty(boolean bIsDirty)
Sets "dirty" (changed) status of this BbAttributes |
void |
setIsDirtyCascading(boolean bIsDirty)
Sets "dirty" (changed) status of this BbAttributes |
void |
setIsSetCascading(boolean bIsSet)
Sets "isSet"status of this BbAttributes |
void |
setLong(java.lang.String strName,
long val)
Sets the value of the attribute with the given name ("key") to the provided long value. |
void |
setLong(java.lang.String strName,
java.lang.Long val)
Sets the value of the attribute with the given name ("key") to the provided Long value. |
void |
setObject(java.lang.String strName)
Sets the value of the attribute with the given name ("key") to the "unset" value. |
void |
setObject(java.lang.String strName,
java.lang.Object val)
Sets the value of the attribute with the given name ("key") to the provided Object value. |
void |
setString(java.lang.String strName,
java.lang.String val)
Sets the value of the attribute with the given name ("key") to the provided String value. |
protected void |
setValue(java.lang.String strName,
java.lang.Object val,
BbAttribute.Type eType)
Internal convenience method to make the type-specific "set" routines much simpler (i.e., shorter). |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BbAttributes()
Method Detail |
---|
protected java.lang.Object getValue(java.lang.String strName, BbAttribute.Type eType) throws BbAttributeException
Object
value associated with given attribute name.
strName
- the string describing the attribute's name ("key").eType
- a type value from BbAttribute.Type
giving the expected
type of the attribute whose value we are getting
Object
.
BbAttributeException
- if an attribute with the given name can not
be found, or the retrieved attribute is not the same type as
provided in the parameter eType
.protected void setValue(java.lang.String strName, java.lang.Object val, BbAttribute.Type eType) throws BbAttributeException
Object
value. This function will not create an attribute if
it does not exist, it will only set the value on already existing attributes.
BbAttributes
should call this method
when setting a value because it performs all of the necessary type checking
and enforcement, however, since it does not create attributes itself (if they
do not exist) the return type needs to be checked to determine whether an
an attribute should be created. Attribute creation should be handled by the
individual "set" methods themselves (and it is therefore important to check
the return value of this method) in order to ensure the correct type of
attribute is created. Because this method treats all values as Object
s, it can only create Object
attributes. I originally
got tripped up by this when I first wrote the method and had it create the
attributes when they didn't exist. That didn't work though and so attribute
creation has now been pushed to the individual "set" methods.
strName
- the string describing the attribute's name ("key").val
- the Integer
to use as the attribute's new value.eType
- a type value from BbAttribute.Type
giving the expected
type of the attribute whose value we are setting
BbAttributeException
- if the attribute with the given name is not
of the the same type as provided in the parameter eType
.public java.lang.Integer getInteger(java.lang.String strName) throws BbAttributeException
Integer
value associated with given attribute name.
strName
- the string describing the attribute's name ("key").
Integer
.
BbAttributeException
- if an attribute with the given name can not
be found, is unset, or the retrieved attribute is not of the
appropriate type (BbAttribute.Type.INTEGER
).public java.lang.Integer getSafeInteger(java.lang.String strName) throws BbAttributeException
Integer
value associated with given attribute name.
Unlike getInteger(String)
the value returned is "safe" such that
null
will never be returned from the method. If the given
attribute has a null value, an appropriate default value will be returned.
strName
- the string describing the attribute's name ("key").
Integer
or a default value if
the attribute value is null
BbAttributeException
- if an attribute with the given name can not
be found, is unset, or the retrieved attribute is not of the
appropriate type (BbAttribute.Type.INTEGER
).public void setInteger(java.lang.String strName, int val) throws BbAttributeException
int
value. If an attribute with the given name can not be
found an attribute with the given name and value will be created.
strName
- the string describing the attribute's name ("key").val
- the int
to use as the attribute's new value.
BbAttributeException
- if the attribute with the given name is not
of the appropriate type (BbAttribute.Type.INTEGER
).public void setInteger(java.lang.String strName, java.lang.Integer val) throws BbAttributeException
Integer
value. If an attribute with the given name can not be
found an attribute with the given name and value will be created.
strName
- the string describing the attribute's name ("key").val
- the Integer
to use as the attribute's new value.
BbAttributeException
- if the attribute with the given name is not
of the appropriate type (BbAttribute.Type.INTEGER
).public java.lang.Long getLong(java.lang.String strName) throws BbAttributeException
Long
value associated with given attribute name.
strName
- the string describing the attribute's name ("key").
Long
.
BbAttributeException
- if an attribute with the given name can not
be found, is unset, or the retrieved attribute is not of the
appropriate type (BbAttribute.Type.LONG
).public java.lang.Long getSafeLong(java.lang.String strName) throws BbAttributeException
Long
value associated with given attribute name.
Unlike getLong(String)
the value returned is "safe" such that
null
will never be returned from the method. If the given
attribute has a null value, an appropriate default value will be returned.
strName
- the string describing the attribute's name ("key").
Long
or a default value if
the attribute value is null
BbAttributeException
- if an attribute with the given name can not
be found, is unset, or the retrieved attribute is not of the
appropriate type (BbAttribute.Type.LONG
).public void setLong(java.lang.String strName, long val) throws BbAttributeException
long
value. If an attribute with the given name can not be
found an attribute with the given name and value will be created.
strName
- the string describing the attribute's name ("key").val
- the long
to use as the attribute's new value.
BbAttributeException
- if the attribute with the given name is not
of the appropriate type (BbAttribute.Type.LONG
).public void setLong(java.lang.String strName, java.lang.Long val) throws BbAttributeException
Long
value. If an attribute with the given name can not be
found an attribute with the given name and value will be created.
strName
- the string describing the attribute's name ("key").val
- the Long
to use as the attribute's new value.
BbAttributeException
- if the attribute with the given name is not
of the appropriate type (BbAttribute.Type.LONG
).public java.lang.Float getFloat(java.lang.String strName) throws BbAttributeException
Float
value associated with given attribute name.
strName
- the string describing the attribute's name ("key").
Float
.
BbAttributeException
- if an attribute with the given name can not
be found, is unset, or the retrieved attribute is not of the
appropriate type (BbAttribute.Type.FLOAT
).public java.lang.Float getSafeFloat(java.lang.String strName) throws BbAttributeException
Float
value associated with given attribute name.
Unlike getFloat(String)
the value returned is "safe" such that
null
will never be returned from the method. If the given
attribute has a null value, an appropriate default value will be returned.
strName
- the string describing the attribute's name ("key").
Float
or a default value if
the attribute value is null
BbAttributeException
- if an attribute with the given name can not
be found, is unset, or the retrieved attribute is not of the
appropriate type (BbAttribute.Type.FLOAT
).public void setFloat(java.lang.String strName, float val) throws BbAttributeException
float
value. If an attribute with the given name can not be
found an attribute with the given name and value will be created.
strName
- the string describing the attribute's name ("key").val
- the float
to use as the attribute's new value.
BbAttributeException
- if the attribute with the given name is not
of the appropriate type (BbAttribute.Type.FLOAT
).public void setFloat(java.lang.String strName, java.lang.Float val) throws BbAttributeException
Float
value. If an attribute with the given name can not be
found an attribute with the given name and value will be created.
strName
- the string describing the attribute's name ("key").val
- the Float
to use as the attribute's new value.
BbAttributeException
- if the attribute with the given name is not
of the appropriate type (BbAttribute.Type.FLOAT
).public java.lang.Double getDouble(java.lang.String strName) throws BbAttributeException
Double
value associated with given attribute name.
strName
- the string describing the attribute's name ("key").
Double
.
BbAttributeException
- if an attribute with the given name can not
be found, is unset, or the retrieved attribute is not of the
appropriate type (BbAttribute.Type.DOUBLE
).public java.lang.Double getSafeDouble(java.lang.String strName) throws BbAttributeException
Double
value associated with given attribute name.
Unlike getDouble(String)
the value returned is "safe" such that
null
will never be returned from the method. If the given
attribute has a null value, an appropriate default value will be returned.
strName
- the string describing the attribute's name ("key").
Double
or a default value if
the attribute value is null
BbAttributeException
- if an attribute with the given name can not
be found, is unset, or the retrieved attribute is not of the
appropriate type (BbAttribute.Type.DOUBLE
).public void setDouble(java.lang.String strName, double val) throws BbAttributeException
double
value. If an attribute with the given name can not be
found an attribute with the given name and value will be created.
strName
- the string describing the attribute's name ("key").val
- the double
to use as the attribute's new value.
BbAttributeException
- if the attribute with the given name is not
of the appropriate type (BbAttribute.Type.DOUBLE
).public void setDouble(java.lang.String strName, java.lang.Double val) throws BbAttributeException
Double
value. If an attribute with the given name can not be
found an attribute with the given name and value will be created.
strName
- the string describing the attribute's name ("key").val
- the Double
to use as the attribute's new value.
BbAttributeException
- if the attribute with the given name is not
of the appropriate type (BbAttribute.Type.DOUBLE
).public java.lang.Boolean getBoolean(java.lang.String strName) throws BbAttributeException
Boolean
value associated with given attribute name.
strName
- the string describing the attribute's name ("key").
Boolean
.
BbAttributeException
- if an attribute with the given name can not
be found, is unset, or the retrieved attribute is not of the
appropriate type (BbAttribute.Type.BOOLEAN
).public java.lang.Boolean getSafeBoolean(java.lang.String strName) throws BbAttributeException
Boolean
value associated with given attribute name.
Unlike getBoolean(String)
the value returned is "safe" such that
null
will never be returned from the method. If the given
attribute has a null value, an appropriate default value will be returned.
strName
- the string describing the attribute's name ("key").
Boolean
or a default value if
the attribute value is null
BbAttributeException
- if an attribute with the given name can not
be found, is unset, or the retrieved attribute is not of the
appropriate type (BbAttribute.Type.BOOLEAN
).public void setBoolean(java.lang.String strName, boolean val) throws BbAttributeException
boolean
value. If an attribute with the given name can not be
found an attribute with the given name and value will be created.
strName
- the string describing the attribute's name ("key").val
- the boolean
to use as the attribute's new value.
BbAttributeException
- if the attribute with the given name is not
of the appropriate type (BbAttribute.Type.BOOLEAN
).public void setBoolean(java.lang.String strName, java.lang.Boolean val) throws BbAttributeException
Boolean
value. If an attribute with the given name can not be
found an attribute with the given name and value will be created.
strName
- the string describing the attribute's name ("key").val
- the Boolean
to use as the attribute's new value.
BbAttributeException
- if the attribute with the given name is not
of the appropriate type (BbAttribute.Type.BOOLEAN
).public java.lang.String getString(java.lang.String strName) throws BbAttributeException
String
value associated with given attribute name.
strName
- the string describing the attribute's name ("key").
String
.
BbAttributeException
- if an attribute with the given name can not
be found, is unset, or the retrieved attribute is not of the
appropriate type (BbAttribute.Type.STRING
).public java.lang.String getSafeString(java.lang.String strName) throws BbAttributeException
String
value associated with given attribute name.
Unlike getString(String)
the value returned is "safe" such that
null
will never be returned from the method. If the given
attribute has a null value, an appropriate default value will be returned.
strName
- the string describing the attribute's name ("key").
String
or a default value if
the attribute value is null
BbAttributeException
- if an attribute with the given name can not
be found, is unset, or the retrieved attribute is not of the
appropriate type (BbAttribute.Type.STRING
).public void setString(java.lang.String strName, java.lang.String val) throws BbAttributeException
String
value. If an attribute with the given name can not be
found an attribute with the given name and value will be created.
strName
- the string describing the attribute's name ("key").val
- the String
to use as the attribute's new value.
BbAttributeException
- if the attribute with the given name is not
of the appropriate type (BbAttribute.Type.STRING
).public java.util.Calendar getCalendar(java.lang.String strName) throws BbAttributeException
Calendar
value associated with given attribute name.
strName
- the string describing the attribute's name ("key").
Calendar
.
BbAttributeException
- if an attribute with the given name can not
be found, is unset, or the retrieved attribute is not of the
appropriate type (BbAttribute.Type.CALENDAR
).public void setCalendar(java.lang.String strName, java.util.Calendar val) throws BbAttributeException
Calendar
value. If an attribute with the given name can not be
found an attribute with the given name and value will be created.
strName
- the string describing the attribute's name ("key").val
- the Calendar
to use as the attribute's new value.
BbAttributeException
- if the attribute with the given name is not
of the appropriate type (BbAttribute.Type.CALENDAR
).public java.lang.Object getObject(java.lang.String strName) throws BbAttributeException
Object
value associated with given attribute name.
strName
- the string describing the attribute's name ("key").
Object
.
BbAttributeException
- if an attribute with the given name can not
be found, is unset, or the retrieved attribute is not of the
appropriate type (BbAttribute.Type.OBJECT
).public void setObject(java.lang.String strName, java.lang.Object val) throws BbAttributeException
Object
value. If an attribute with the given name can not be
found an attribute with the given name and value will be created.
strName
- the string describing the attribute's name ("key").val
- the Object
to use as the attribute's new value.
BbAttributeException
- if the attribute with the given name is not
of the appropriate type (BbAttribute.Type.OBJECT
).public void setObject(java.lang.String strName) throws BbAttributeException
strName
- the string describing the attribute's name ("key").
BbAttributeException
- if the attribute with the given name is not
of the appropriate type (BbAttribute.Type.OBJECT
).public Id getId(java.lang.String strName) throws BbAttributeException
Id
value associated with given attribute name.
strName
- the string describing the attribute's name ("key").
Id
.
BbAttributeException
- if an attribute with the given name can not
be found, is unset, or the retrieved attribute is not of the
appropriate type (BbAttribute.Type.ID
).public Id getSafeId(java.lang.String strName) throws BbAttributeException
Id
value associated with given attribute name. Unlike
getId(String)
the value returned is "safe" such that null
will never be returned from the method. If the given attribute has
a null value, an appropriate default value will be returned.
strName
- the string describing the attribute's name ("key").
Id
or a default value if the
attribute value is null
BbAttributeException
- if an attribute with the given name can not
be found, is unset, or the retrieved attribute is not of the
appropriate type (BbAttribute.Type.ID
).public void setId(java.lang.String strName, Id val) throws BbAttributeException
Id
value. If an attribute with the given name can not be
found an attribute with the given name and value will be created.
strName
- the string describing the attribute's name ("key").val
- the Id
to use as the attribute's new value.
BbAttributeException
- if the attribute with the given name is not
of the appropriate type (BbAttribute.Type.ID
).public BbEnum getBbEnum(java.lang.String strName) throws BbAttributeException
BbEnum
value associated with given attribute name.
strName
- the string describing the attribute's name ("key").
BbEnum
.
BbAttributeException
- if an attribute with the given name can not
be found, is unset, or the retrieved attribute is not of the
appropriate type (BbAttribute.Type.BBENUM
).public void setBbEnum(java.lang.String strName, BbEnum val) throws BbAttributeException
BbEnum
value. If an attribute with the given name can not be
found an attribute with the given name and value will be created.
strName
- the string describing the attribute's name ("key").val
- the BbEnum
to use as the attribute's new value.
BbAttributeException
- if the attribute with the given name is not
of the appropriate type (BbAttribute.Type.BBENUM
).public FormattedText getFormattedText(java.lang.String strName) throws BbAttributeException
FormattedText
value associated with given attribute name.
strName
- the string describing the attribute's name ("key").
FormattedText
.
BbAttributeException
- if an attribute with the given name can not
be found, is unset, or the retrieved attribute is not of the
appropriate type (BbAttribute.Type.FORMATTEDTEXT
).public FormattedText getSafeFormattedText(java.lang.String strName) throws BbAttributeException
FormattedText
value associated with given attribute name.
Unlike getFormattedText(String)
the value returned is "safe" such
that null
will never be returned from the method. If the
given attribute has a null value, an appropriate default value will be returned.
strName
- the string describing the attribute's name ("key").
FormattedText
or a default value if
the attribute value is null
BbAttributeException
- if an attribute with the given name can not
be found, is unset, or the retrieved attribute is not of the
appropriate type (BbAttribute.Type.FORMATTEDTEXT
).public void setFormattedText(java.lang.String strName, FormattedText val) throws BbAttributeException
FormattedText
value. If an attribute with the given name can
not be found an attribute with the given name and value will be created.
strName
- the string describing the attribute's name ("key").val
- the FormattedText
to use as the attribute's new value.
BbAttributeException
- if the attribute with the given name is not
of the appropriate type (BbAttribute.Type.FORMATTEDTEXT
).public IBbObject getBbObject(java.lang.String strName) throws BbAttributeException
IBbObject
value associated with given attribute name.
strName
- the string describing the attribute's name ("key").
IBbObject
.
BbAttributeException
- if an attribute with the given name can not
be found, is unset, or the retrieved attribute is not of the
appropriate type (BbAttribute.Type.BBOBJECT
).public void setBbObject(java.lang.String strName, IBbObject val) throws BbAttributeException
IBbObject
value. If an attribute with the given name can not be
found an attribute with the given name and value will be created.
strName
- the string describing the attribute's name ("key").val
- the IBbObject
to use as the attribute's new value.
BbAttributeException
- if the attribute with the given name is not
of the appropriate type (BbAttribute.Type.BBOBJECT
).public void setBbObject(java.lang.String strName) throws BbAttributeException
strName
- the string describing the attribute's name ("key").
BbAttributeException
- if the attribute with the given name is not
of the appropriate type (BbAttribute.Type.BBOBJECT
).public void addBbAttribute(BbAttribute theAttrib)
setType
methods instead
BbAttribute
already exists, nothing is done.
theAttrib
- the BbAttribute
to be added.public void removeBbAttribute(java.lang.String strName)
BbAttribute
object associated with the given name ("key")
strName
- the string describing the attribute's name ("key").public BbAttribute getBbAttribute(java.lang.String strName)
BbAttribute
object associated with given name ("key").
strName
- the string describing the attribute's name ("key").
BbAttribute
associated with the given name, null if
the attribute can not be locatedpublic boolean getIsDirty()
BbAttributes
. This attribute
collection is "dirty" if its value has been changed sinced a saved state (a
change occurs when an attribute is added to the collection, or a contained
attribute is modified). BbAttributes
starts out "dirty" since
it has yet to be saved to any location.
BbAttributes
.
true if this attribute container is "dirty", false otherwise.public void setIsDirty(boolean bIsDirty)
BbAttributes
bIsDirty
- boolean flag denoting whether a change has been made to
this set of attributes.public void setIsDirtyCascading(boolean bIsDirty)
BbAttributes
bIsDirty
- boolean flag denoting whether a change has been made to
this set of attributes.public void setIsSetCascading(boolean bIsSet)
BbAttributes
bIsDirty
- boolean flag denoting whether the attribute has been set to
this group of attributes.public void reset()
BbAttributes
bIsDirty
- boolean flag denoting whether the attribute has been set to
this group of attributes.public java.util.List getBbAttributeList()
BbAttribute
values. Values
in the list must be cast before being used as BbAttribute
values.
BbAttribute
values contained by this
public java.lang.Object clone()
clone
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |