|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object i3.dragos.gm.core.proxy.AttributeProxy
public class AttributeProxy
A AttributeProxy
delegates all method calls to the underlying
attribtue except for those that access fields which are used after a
attribute has been deleted.
Field Summary | |
---|---|
protected Attribute |
proxiedAttribute
The attribute we wrap. |
Constructor Summary | |
---|---|
AttributeProxy(Attribute proxiedAttribute)
Constructs a new wrapper for an attribute. |
Method Summary | |
---|---|
void |
checkExistence()
Checks whether this object still exists, throwing an exception if not. |
void |
checkExistenceOptional()
Checks whether this object still exists, throwing an exception if not. |
boolean |
equals(java.lang.Object o)
Checks for equality with another object. |
java.util.Map<java.lang.String,java.io.Serializable> |
getAllMetaAttributes()
Returns a map containing all currently set meta-attribute key-value pairs. |
DataSourceURL |
getDataSourceURL()
Returns the DataSourceURL of the schema this attribute belongs to. |
GraphEntityClass |
getGraphEntityClass()
Returns the schema entity the attribute belongs to. |
java.io.Serializable |
getInternalIdentifier()
Returns the internal internal identifier of the attribute. |
java.io.Serializable |
getMetaAttribute(java.lang.String key)
Returns the current value of a meta-attribute. |
java.lang.String |
getName()
Returns the attribute's name. |
Attribute |
getProxyAttribute()
Returns the attribute which is encapsulated by this proxy. |
java.lang.Class |
getType()
Returns the attribute's value type. |
Attribute |
getWrappedAttribute()
Returns the wrapped attribute, null if none. |
int |
hashCode()
To comply with the general contract for Object.hashCode() ,
it is recommended to return the hash code of the internal identifier. |
boolean |
isMetaAttributeKeyReserved(java.lang.String key)
Checks whether a meta-attribute key is reserved for internal use. |
boolean |
isMetaAttributeSet(java.lang.String key)
Checks whether a meta-attribute is set. |
void |
setMetaAttribute(java.lang.String key,
java.io.Serializable value)
Sets a meta-attribute. |
java.lang.String |
toString()
|
void |
unsetMetaAttribute(java.lang.String key)
Removes a meta-attribute. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected final Attribute proxiedAttribute
Constructor Detail |
---|
public AttributeProxy(Attribute proxiedAttribute)
proxiedAttribute
- The attribute to wrap.Method Detail |
---|
public Attribute getProxyAttribute()
public DataSourceURL getDataSourceURL()
null
.
getDataSourceURL
in interface Attribute
public GraphEntityClass getGraphEntityClass() throws DragosException
getGraphEntityClass
in interface Attribute
DragosException
- if something went wrong.public java.io.Serializable getInternalIdentifier()
getInternalIdentifier
in interface Attribute
public int hashCode()
Object.hashCode()
,
it is recommended to return the hash code of the internal identifier.
hashCode
in interface Attribute
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
public boolean equals(java.lang.Object o)
This object is considered equal if all of the following conditions are met:
o != null
o instanceof AbstractAttribute
getDataSourceURL().equals(((GraphEntity) o).getDataSourceURL())
getInternalIdentifier().equals(((GraphEntity) o).getInternalIdentifier())
Subclasses and implementations might want to extend it by adding
assertions comparing additional or internal data. However, equality must
only be determined by above rules, preferably by using
super.equals(o)
, and any differences in the additional
data for two equal attributes is to be considered an error.
equals
in interface Attribute
equals
in class java.lang.Object
o
- The Object to compare to.
true
if o
is equal according to
above rules, false
otherwise.public java.lang.String getName()
getName
in interface Attribute
public java.lang.Class getType()
getType
in interface Attribute
public Attribute getWrappedAttribute()
null
if none.
getWrappedAttribute
in interface Attribute
null
if none.public void checkExistence() throws java.lang.RuntimeException
checkExistence
in interface ExistenceCheckable
java.lang.RuntimeException
- if this object no longer exists or an error occurred while accessing the GraphPool.public void checkExistenceOptional() throws java.lang.RuntimeException
A useful default implementation would be as follows:
try { GraphPool gp = GraphPoolFactory.get(getDataSourceURL()); if (gp.getForceExistenceCheckOnRead()) { checkExistence(); } } catch (DragosException e) { String message = "Caught GraphPoolException while trying to determine whether to perform checks on read operation!"; log.error(message); throw new RuntimeException(message); }
checkExistenceOptional
in interface ExistenceCheckable
java.lang.RuntimeException
- if this object no longer exists or an error occurred while accessing the GraphPool.public java.util.Map<java.lang.String,java.io.Serializable> getAllMetaAttributes() throws DragosException
getAllMetaAttributes
in interface MetaAttributable
Map
containing key-value pairs for all set meta-attributes.
DragosException
- if this object is no longer in its GraphPool/Schema, or something else went wrong.public java.io.Serializable getMetaAttribute(java.lang.String key) throws EntityNotFoundException, DragosException
getMetaAttribute
in interface MetaAttributable
key
- The key that identifies the meta attribute.
EntityNotFoundException
- if no meta-attribute with that name exists.
DragosException
- if this object is no longer in its GraphPool/Schema, or something else went wrong.public boolean isMetaAttributeKeyReserved(java.lang.String key) throws DragosException
isMetaAttributeKeyReserved
in interface MetaAttributable
key
- The key in question.
true
if this meta-attribute key is reserved, false
otherwise.
DragosException
- if this object is no longer in its GraphPool/Schema, or something else went wrong.public boolean isMetaAttributeSet(java.lang.String key) throws EntityNotFoundException, DragosException
isMetaAttributeSet
in interface MetaAttributable
key
- The key that identifies the meta attribute.
true
if the meta-attribute is set, false
otherwise.
DragosException
- if this object is no longer in its GraphPool/Schema, or something else went wrong.
EntityNotFoundException
public void setMetaAttribute(java.lang.String key, java.io.Serializable value) throws EntityInUseException, DragosException
setMetaAttribute
in interface MetaAttributable
key
- The key that identifies the meta attribute.value
- The (new) value of this meta-attribute.
EntityInUseException
- if a key name is reserved for internal use.
DragosException
- if this object is no longer in its GraphPool/Schema, or something else went wrong.public void unsetMetaAttribute(java.lang.String key) throws EntityInUseException, DragosException
unsetMetaAttribute
in interface MetaAttributable
key
- The key that identifies the meta attribute.
EntityInUseException
- if a key name is reserved for internal use.
DragosException
- if this object is no longer in its GraphPool/Schema, or something else went wrong.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |