ch.elca.el4j.services.persistence.hibernate.dao.extent
Class ExtentEntity

java.lang.Object
  extended by ch.elca.el4j.services.persistence.hibernate.dao.extent.AbstractExtentPart
      extended by ch.elca.el4j.services.persistence.hibernate.dao.extent.ExtentEntity
All Implemented Interfaces:
Serializable, Comparable<AbstractExtentPart>

public class ExtentEntity
extends AbstractExtentPart

A ExtentEntity represents a complex Data Type in an Extent.
Features:

Author:
Andreas Rueedlinger (ARR)
See Also:
Serialized Form
File-location:
ExtentEntity
Last check-in date:
2009-08-04 14:35:53 +0200 (Di, 04. Aug 2009) by swismer for revision 3875

Field Summary
 
Fields inherited from class ch.elca.el4j.services.persistence.hibernate.dao.extent.AbstractExtentPart
m_name, m_parent
 
Constructor Summary
ExtentEntity(Class<?> c)
          Default Creator, hidden.
ExtentEntity(Class<?> c, Method method)
          Default Creator, hidden.
ExtentEntity(String name, Class<?> c)
          Default Creator, hidden.
 
Method Summary
 ExtentEntity all(int depth)
          Include all fields, entities and collections of the class-entity.
static ExtentEntity entity(Class<?> c)
          Returns a new Entity object, based on the given class.
static ExtentEntity entity(Class<?> c, Method m)
          Returns a new Entity object, based on the given class and method.
static ExtentEntity entity(String name, Class<?> c)
          Returns a new Entity object, based on the given name and class.
 ExtentEntity freeze()
          Freeze the ExtentEntity, meaning that no further changes to it are possible.
 List<ExtentEntity> getChildEntities()
          Child entities.
 List<ExtentCollection> getCollections()
          Collections.
 Class<?> getEntityClass()
          Class of the entity.
 List<String> getFields()
          Field-methods of the entity.
 String getId()
          
 boolean isRoot()
           
 ExtentEntity merge(ExtentEntity other)
          Merge two ExtentEntities.
static ExtentEntity rootEntity(Class<?> c)
          Returns a new Entity object, based on the given class.
 String toString()
          
protected  void updateId()
          Updates the id of the extent part.
 ExtentEntity with(String... fields)
          Extend the entity by the given fields.
 ExtentEntity without(String... fields)
          Exclude fields from the entity.
 ExtentEntity withSubentities(AbstractExtentPart... entities)
          Extend the entity by the given sub-entities.
 
Methods inherited from class ch.elca.el4j.services.persistence.hibernate.dao.extent.AbstractExtentPart
compareTo, equals, firstCharLower, firstCharUpper, getMethod, getName, getParent, hashCode, nativeToString, setParent, toFieldName
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ExtentEntity

public ExtentEntity(Class<?> c)
Default Creator, hidden.

Parameters:
c - the class of the entity

ExtentEntity

public ExtentEntity(String name,
                    Class<?> c)
Default Creator, hidden.

Parameters:
name - the name of the entity
c - the class of the entity

ExtentEntity

public ExtentEntity(Class<?> c,
                    Method method)
Default Creator, hidden.

Parameters:
c - the class of the entity
method - the method to get the entity
Method Detail

getId

public String getId()

Specified by:
getId in class AbstractExtentPart
Returns:
the id of the extent part.

updateId

protected void updateId()
Updates the id of the extent part. Should be used be children to inform its parent.

Specified by:
updateId in class AbstractExtentPart

isRoot

public boolean isRoot()
Returns:
if the entity is a root entity.

getEntityClass

public Class<?> getEntityClass()
Class of the entity.

Returns:
the class of the entity.

getFields

public List<String> getFields()
Field-methods of the entity.

Returns:
the field-methods of the entity.

getChildEntities

public List<ExtentEntity> getChildEntities()
Child entities.

Returns:
the child entities of the entity.

getCollections

public List<ExtentCollection> getCollections()
Collections.

Returns:
the collections of the entity.

rootEntity

public static ExtentEntity rootEntity(Class<?> c)
Returns a new Entity object, based on the given class.

Parameters:
c - the class of the entity.
Returns:
the Entity object.

entity

public static ExtentEntity entity(Class<?> c)
Returns a new Entity object, based on the given class.

Parameters:
c - the class of the entity.
Returns:
the Entity object.

entity

public static ExtentEntity entity(String name,
                                  Class<?> c)
Returns a new Entity object, based on the given name and class.

Parameters:
name - the name of the entity.
c - the class of the entity.
Returns:
the Entity object.

entity

public static ExtentEntity entity(Class<?> c,
                                  Method m)
Returns a new Entity object, based on the given class and method.

Parameters:
c - the class of the entity.
m - the method to get the entity.
Returns:
the Entity object.

with

public ExtentEntity with(String... fields)
                  throws NoSuchMethodException
Extend the entity by the given fields. Fields are either simple properties, sub-entities or collections.

Parameters:
fields - fields to be added.
Returns:
the new ExtentEntity Object.
Throws:
NoSuchMethodException

withSubentities

public ExtentEntity withSubentities(AbstractExtentPart... entities)
                             throws NoSuchMethodException
Extend the entity by the given sub-entities.

Parameters:
entities - entities to be added.
Returns:
the new ExtentEntity Object.
Throws:
NoSuchMethodException

without

public ExtentEntity without(String... fields)
Exclude fields from the entity. Fields are either simple properties, sub-entities or collections.

Parameters:
fields - fields to be excluded.
Returns:
the new ExtentEntity Object.

all

public ExtentEntity all(int depth)
Include all fields, entities and collections of the class-entity.

Parameters:
depth - Exploration depth.
Returns:
the new ExtentEntity Object.

merge

public ExtentEntity merge(ExtentEntity other)
Merge two ExtentEntities. Returns the union of the entities. The class of the two entities should be the same, the name and the parent is taken from this object.

Parameters:
other - the extent to be merged with.
Returns:
the merged entity.

freeze

public ExtentEntity freeze()
Freeze the ExtentEntity, meaning that no further changes to it are possible.

Returns:
the frozen ExtentEntity.

toString

public String toString()

Overrides:
toString in class AbstractExtentPart


Copyright © 2005-2011 ELCA. All Rights Reserved.