|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface GraphEntityClass
The GraphEntityClass
interface defines the properties that
hold for all schema elements.
Method Summary | |
---|---|
void |
addSubClass(GraphEntityClass clazz)
Adds the specified class to the set of sub classes of this class. |
Attribute |
declareAttribute(java.lang.String name,
java.lang.Class type)
Declares a new attribute with the given name and type. |
boolean |
equals(java.lang.Object o)
Checks for equality with another object. |
java.util.Collection<? extends Attribute> |
getAllDeclaredAttributes()
Returns a collection containg all attributes declared in this graph element class and all its super classes. |
java.util.Collection<? extends GraphEntityClass> |
getAllSubClasses()
Returns all sub classes of this class. |
java.util.Collection<? extends GraphEntityClass> |
getAllSuperClasses()
Returns all super classes of this class. |
Attribute |
getAttribute(java.lang.String name)
Returns the attribute with the given name. |
DataSourceURL |
getDataSourceURL()
Returns the URL to the data source that stores this graph entity class. |
java.util.Collection<? extends Attribute> |
getDeclaredAttributes()
Returns a collection containing the attributes declared for the schema entity. |
java.util.Collection<? extends GraphEntityClass> |
getDirectSubClasses()
Returns all direct sub classes of this class. |
java.util.Collection<? extends GraphEntityClass> |
getDirectSuperClasses()
Returns all direct super classes of this class. |
java.io.Serializable |
getInternalIdentifier()
Returns the internal identifier used to uniquely identify this object in the storage backend. |
java.lang.String |
getName()
Returns the name of the graph entity class. |
GraphEntityClass |
getWrappedGraphEntityClass()
Returns the wrapped entity class, null if none. |
boolean |
hasAttribute(java.lang.String name)
Returns true if an attribute with the given name is
declared in the graph entity class. |
int |
hashCode()
To comply with the general contract for Object.hashCode() , it is
recommended to return the hash code of the internal identifier. |
boolean |
isAbstract()
Returns true if the schema entity is abstract or
false otherwise. |
boolean |
isSubClassOf(GraphEntityClass clazz)
Returns true if the specified class is the same as this
class or a super class of this class and false otherwise. |
boolean |
isSuperClassOf(GraphEntityClass clazz)
Returns true if the specified class is the same as this
class or a sub class of this class and false otherwise. |
void |
removeSubClass(GraphEntityClass clazz)
Removes the specified class from the set of direct sub classes of this class. |
void |
undeclareAllAttributes()
Undeclares all attributes of this graph entity class. |
void |
undeclareAttribute(Attribute attribute)
Undeclares an attribute. |
void |
undeclareAttribute(java.lang.String name)
Undeclares the attribute with the given name. |
Methods inherited from interface i3.dragos.gm.core.schema.MetaAttributable |
---|
getAllMetaAttributes, getMetaAttribute, isMetaAttributeKeyReserved, isMetaAttributeSet, setMetaAttribute, unsetMetaAttribute |
Methods inherited from interface i3.dragos.gm.core.schema.ExistenceCheckable |
---|
checkExistence, checkExistenceOptional |
Method Detail |
---|
boolean equals(java.lang.Object o)
This object is considered equal if all of the following conditions are met:
o != null
o instanceof GraphEntity
getDataSourceURL().equals(((GraphEntity) o).getDataSourceURL())
getInternalIdentifier().equals(((GraphEntity) o).getInternalIdentifier())
Subclasses and implementations might want to extend this list by adding
assertions comparing additional or internal data (e.g. the type of the
graph entity). However, equality must only be determined by the above
rules, preferably by using super.equals(o)
, and any
difference in the additional data for two object equal according to the
rules above is to be considered an error.
equals
in class java.lang.Object
o
- The Object to compare to.
true
if o
is equal according to
above rules, false
otherwise.DataSourceURL getDataSourceURL()
null
.
java.io.Serializable getInternalIdentifier()
To retrieve the entity use
Schema.getGraphEntityClassByInternalIdentifier(Serializable)
As
alternative you may consider to use the classes in the package
i3.dragos.gm.core.schema.id
.
int hashCode()
Object.hashCode()
, it is
recommended to return the hash code of the internal identifier.
hashCode
in class java.lang.Object
java.lang.String getName() throws DragosException
DragosException
- if something went wrong.Attribute declareAttribute(java.lang.String name, java.lang.Class type) throws EntityAlreadyExistsException, DragosException
null
.
name
- The name of the attribute.type
- The type of the attribute.
EntityAlreadyExistsException
- if an attribute with the given name already exists.
java.lang.IllegalArgumentException
- if name or type is null
.
DragosException
- if something went wrong.void undeclareAttribute(java.lang.String name) throws EntityNotFoundException, DragosException
All instances of this attribute are removed from the graph pool
associated with this schema, using
GraphPool.removeAllAttributeInstances(Attribute)
,
before the attribute itself is undeclared.
Note that this method only works for attributes declared for this class, not for those declared for any super classes in the inheritance hierachy.
name
- The name of the attribute.
EntityNotFoundException
- if no attribute with the given name is declared for this
GraphEntityClass.
DragosException
- if something went wrong.void undeclareAttribute(Attribute attribute) throws EntityNotFoundException, DragosException
All instances of this attribute are removed from the graph pool
associated with this schema, using
GraphPool.removeAllAttributeInstances(Attribute)
,
before the attribute itself is undeclared.
Note that this method only works for attributes declared for this class, not for those declared for any super classes in the inheritance hierachy.
attribute
- The attribute.
EntityNotFoundException
- if the attribute is not declared for this GraphEntityClass.
DragosException
- if something went wrong.void undeclareAllAttributes() throws DragosException
All instances of an attribute are removed from the graph pool associated
with this schema, using
GraphPool.removeAllAttributeInstances(Attribute)
,
before the attribute itself is undeclared. You may first remove all
instances of all attributes, and then undeclare all attributes at once,
or you may process each attribute seperately at your discretion.
Note that this method only works for attributes declared for this class, not for those declared for any super classes in the inheritance hierachy.
DragosException
- if something went wrong.java.util.Collection<? extends Attribute> getDeclaredAttributes() throws DragosException
Attribute
.
Note that this method only works for attributes declared for this class, not for those declared for any super classes in the inheritance hierachy.
DragosException
- if something went wrong.Attribute getAttribute(java.lang.String name) throws EntityNotFoundException, DragosException
Note that this method only works for attributes declared for this class, not for those declared for any super classes in the inheritance hierachy.
name
- The name of the requested attribute.
EntityNotFoundException
- if no attribute with the given name exists.
DragosException
- if something went wrong.boolean hasAttribute(java.lang.String name) throws DragosException
true
if an attribute with the given name is
declared in the graph entity class.
Note that this method only works for attributes declared for this class, not for those declared for any super classes in the inheritance hierachy.
name
- The name of the requested attribute.
DragosException
- if something went wrong.void addSubClass(GraphEntityClass clazz) throws EntityNotFoundException, InheritanceCycleException, DragosException
If clazz
is already a direct sub class of this
class, no action will be performed. Of course, this class will be added
to the list of super classes of clazz
.
If adding this sub class would result in circular references, a InheritanceCycleException is thrown, and no action will be performed.
When called on a specialized subinterface of GraphEntityClass (e.g. EdgeClass), the argument must be of the same type. You can not subclass an EdgeClass with a RelationClass, for example. If the parameter is invalid, a DragosException is thrown, and no action will be performed.
clazz
- The class which should be a sub class of this class.
EntityNotFoundException
- if clazz does not exist in this schema.
InheritanceCycleException
- if the inheritance relation would introduce a cycle.
DragosException
- if clazz is of a different specialized type, or an internal error occurs.void removeSubClass(GraphEntityClass clazz) throws EntityNotFoundException, DragosException
clazz
.
clazz
- The sub class to remove.
EntityNotFoundException
- if clazz does not exist in this schema or is not a direct sub
class.
DragosException
- in case of internal errors.java.util.Collection<? extends GraphEntityClass> getDirectSuperClasses() throws DragosException
GraphEntityClass
.
DragosException
- if something went wrong.java.util.Collection<? extends GraphEntityClass> getAllSuperClasses() throws DragosException
GraphEntityClass
.
While the sub class relationship is reflective (meaning
c.isSuperClassOf(c)
returns true
for any
GraphEntityClass c
), the class this method is called on
itself will not be included in the returned Collection. This decision was
made because in practical use of this method one in most cases is only
interested in real super classes.
DragosException
- if something went wrong.java.util.Collection<? extends GraphEntityClass> getDirectSubClasses() throws DragosException
GraphEntityClass
.
DragosException
- if something went wrong.java.util.Collection<? extends GraphEntityClass> getAllSubClasses() throws DragosException
GraphEntityClass
.
While the sub class relationship is reflective (meaning
c.isSubClassOf(c)
returns true
for any
GraphEntityClass c
), the class this method is called on
itself will not be included in the returned Collection. This decision was
made because in practical use of this method one in most cases is only
interested in real sub classes.
DragosException
- if something went wrong.boolean isSuperClassOf(GraphEntityClass clazz) throws EntityNotFoundException, DragosException
true
if the specified class is the same as this
class or a sub class of this class and false
otherwise.
clazz
- The class which is tested.
true
if the specified class is a super class of
this class and false
otherwise.
EntityNotFoundException
- if the graph element class could not be found.
DragosException
- if something went wrong.boolean isSubClassOf(GraphEntityClass clazz) throws EntityNotFoundException, DragosException
true
if the specified class is the same as this
class or a super class of this class and false
otherwise.
clazz
- The class which is tested.
true
if the specified class is a super class of
this class and false
otherwise.
EntityNotFoundException
- if the graph element class could not be found.
DragosException
- if something went wrong.boolean isAbstract() throws DragosException
true
if the schema entity is abstract or
false
otherwise. If a graph element class is abstract no
graph element can be constructed for it.
true
if the schema entity is abstract or
false
otherwise.
DragosException
- if something went wrong.java.util.Collection<? extends Attribute> getAllDeclaredAttributes() throws DragosException
Attribute
.
DragosException
- if something went wrong.GraphEntityClass getWrappedGraphEntityClass()
null
if none.
For subinterfaces defined in the core GM (like EdgeClass, NodeClass...),
the returned value is guaranteed to be an instance of the same
subinterface.
null
if none.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |