|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.sas.entities.BaseEntity
public class BaseEntity
BaseEntity is an entity object that is not a remote object.
It is a simple entity object that contains methods for setting and getting attribute values.
Unlike Entity
, it does not create an AttributeGroup or AttributeDescriptors
for its attributes.
Entity
Constructor Summary | |
---|---|
BaseEntity()
Create a default entity. |
Method Summary | |
---|---|
java.lang.Object |
clone()
Create a new BaseEntity object using the BaseEntity's attributes. |
boolean |
containsAttributeNamed(java.lang.String attributeName)
Test if the Entity contains an attribute of a specified name. |
boolean |
equals(BaseEntity p)
Returns a boolean indicating whether the entities are "equal". |
boolean |
equals(java.lang.Object o)
Returns a boolean indicating whether the entities are "equal". |
java.lang.Object |
getAttribute(java.lang.String attributeName)
Get an attribute value from the Entity. |
java.lang.Object |
getAttribute(java.lang.String attributeName,
java.lang.Object defaultValue)
Get a value of an attribute from the Entity or return a default value if it does not exist. |
int |
getAttributeCount()
Returns the number of attributes defined. |
java.util.Map |
getAttributes(java.util.Map query)
Perform a bulk value get on the Entity. |
java.lang.String |
getEntityKey()
Return this entity's key or GUID (Globally Unique Identifier). |
java.util.Map |
getPropertyDescriptors()
Returns a map of PropertyDescriptors. |
java.lang.String |
getStringAttribute(java.lang.String attributeName,
java.lang.String defaultValue)
Get a string value of an attribute from the Entity. |
java.lang.String[] |
listAttributeNames()
Return an array of the attribute names on the Entity. |
void |
removeAllAttributes()
Remove all attributes from the Entity. |
void |
removeAttribute(java.lang.String attributeName)
Remove an attribute from the Entity if the attribute is an instance-based attribute. |
void |
reset()
Clear the underlying list, reset fields to default values and release references to other non-default objects held by this instance. |
boolean |
sameEntity(EntityKeyInterface entity)
Test if this Entity's key equals the key of another Entity. |
void |
setAttribute(java.lang.String attributeName,
java.lang.Object value)
Set an attribute and its value in the Entity. |
void |
setAttributes(java.util.Map update)
Perform a bulk attribute set on the Entity. |
void |
setEntityKey(java.lang.String guid)
Assign this entity's key or GUID (Globally Unique Identifier). |
java.lang.String |
toString()
Returns the string representation of the Entity. |
Constructor Detail |
---|
public BaseEntity()
Method Detail |
---|
public java.lang.String getEntityKey()
getEntityKey
in interface EntityKeyInterface
setEntityKey(String guid)
public void setEntityKey(java.lang.String guid)
setEntityKey
in interface EntityKeyInterface
guid
- a unique entity key, also known as a Globally Unique Identifer (GUID)
java.lang.IllegalStateException
- Subclasses may throw an IllegalStateException if this
entity already has a GUID, although this base class method does not.getEntityKey()
public boolean sameEntity(EntityKeyInterface entity)
EntityKeyInterface
sameEntity
in interface EntityKeyInterface
EntityKeyInterface.getEntityKey()
. Return false if entity is
null
public void removeAttribute(java.lang.String attributeName)
BaseEntityInterface
BaseEntityInterface.containsAttributeNamed(String)
will return false
and BaseEntityValueInterface.getAttribute(String)
will throw a NoSuchElementException
removeAttribute
in interface BaseEntityInterface
attributeName
- the name of the attributepublic void removeAllAttributes()
BaseEntityInterface
removeAllAttributes
in interface BaseEntityInterface
public void reset()
public java.lang.Object getAttribute(java.lang.String attributeName) throws java.util.NoSuchElementException
BaseEntityValueInterface
getAttribute
in interface BaseEntityValueInterface
attributeName
- the name of the value
java.util.NoSuchElementException
- if there
is no such value in the Entity
(this is necessary to distinguish between
no such attributeName and a value of null)public java.lang.Object getAttribute(java.lang.String attributeName, java.lang.Object defaultValue)
BaseEntityInterface
getAttribute
in interface BaseEntityInterface
attributeName
- the name of the valuedefaultValue
- a default value to return if the named attribute,
attributeName does not exist in the Entity
public java.util.Map getAttributes(java.util.Map query)
BaseEntityInterface
getAttributes
in interface BaseEntityInterface
query
- a set of name/value pairs. This
object is updated if the operation is performed locally.
BaseEntityInterface.setAttributes(Map update)
public java.lang.String getStringAttribute(java.lang.String attributeName, java.lang.String defaultValue)
BaseEntityInterface
BaseEntityValueInterface.getAttribute(String)
.
getStringAttribute
in interface BaseEntityInterface
attributeName
- the name of the valuedefaultValue
- a default value to return if the named attribute,
attributeName does not exist in the Entity
public void setAttribute(java.lang.String attributeName, java.lang.Object value) throws AttributeSetException
BaseEntityValueInterface
setAttribute
in interface BaseEntityValueInterface
attributeName
- the name of the attributevalue
- the value to associate with the attribute.
Attribute values may be null if permitted by the AttributeType
associated with the AttributeDescriptor
AttributeSetException
- if the AttributeType of the parameter, value, is not compatible
with a previous setting of the attribute OR the attribute corresponding to the
parameter, attributeName, has been designated as non-modifiableAttributeTypeInterface
public void setAttributes(java.util.Map update) throws AttributeSetException
BaseEntityInterface
setAttributes
in interface BaseEntityInterface
update
- a set of name/value pairs to assign to the attributes
of the Entity
AttributeSetException
- if the AttributeType of a parameter is not compatible
with a previous setting of the attribute OR an attribute
has been designated as non-modifiableBaseEntityInterface.getAttributes(Map query)
public java.util.Map getPropertyDescriptors()
public boolean containsAttributeNamed(java.lang.String attributeName)
BaseEntityInterface
containsAttributeNamed
in interface BaseEntityInterface
attributeName
- the attribute name to test
public int getAttributeCount()
public java.lang.String[] listAttributeNames()
BaseEntityInterface
listAttributeNames
in interface BaseEntityInterface
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
public boolean equals(BaseEntity p)
p
- instance of BaseEntity to compare
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
o
- the object to compare
public java.lang.String toString()
toString
in class java.lang.Object
|
Components |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |