org.chromattic.core
Class EntityContext

java.lang.Object
  extended by org.chromattic.core.ObjectContext<EntityContext>
      extended by org.chromattic.core.EntityContext
All Implemented Interfaces:
MethodHandler

public final class EntityContext
extends ObjectContext<EntityContext>

Version:
$Revision$
Author:
Julien Viet

Method Summary
<T> T
adapt(java.lang.Class<T> adaptedClass)
          Adapts the current object held by this context to the specified type.
 void addMixin(EmbeddedContext mixinCtx)
           
 boolean addReference(java.lang.String name, EntityContext referentCtx, LinkType linkType)
           
 java.lang.String decodeName(java.lang.String name, NameKind nameKind)
           
 java.lang.String encodeName(java.lang.String name, NameKind nameKind)
           
 java.lang.String getAttribute(NodeAttributeType type)
           
 java.lang.Object getAttribute(java.lang.Object key)
           
 EmbeddedContext getEmbedded(java.lang.Class<?> embeddedType)
           
 EntityContext getEntity()
           
 java.lang.String getId()
           
 java.lang.String getLocalName()
           
 ObjectMapper<EntityContext> getMapper()
           
 javax.jcr.Node getNode()
           
 java.lang.Object getObject()
           
 EntityContext getParent()
           
 java.lang.String getPath()
           
 EntityContext getReferenced(java.lang.String name, LinkType linkType)
           
<T> java.util.Iterator<T>
getReferents(java.lang.String name, java.lang.Class<T> filterClass, LinkType linkType)
           
 DomainSession getSession()
           
 Status getStatus()
           
 PrimaryTypeInfo getTypeInfo()
          Returns the type info associated with the context.
 void remove()
           
 void removeMixin(java.lang.Class<?> mixinType)
           
 java.lang.Object setAttribute(java.lang.Object key, java.lang.Object value)
           
 void setLocalName(java.lang.String name)
           
 void setReferenced(java.lang.String name, EntityContext referencedCtx, LinkType linkType)
           
 java.lang.String toString()
           
 
Methods inherited from class org.chromattic.core.ObjectContext
addChild, addChild, getChild, getChildren, getPropertyValue, getPropertyValues, hasChild, hasProperty, invoke, invoke, invoke, orderBefore, removeChild, setPropertyValue, setPropertyValues
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getAttribute

public java.lang.Object getAttribute(java.lang.Object key)

setAttribute

public java.lang.Object setAttribute(java.lang.Object key,
                                     java.lang.Object value)

getNode

public javax.jcr.Node getNode()

getSession

public DomainSession getSession()
Specified by:
getSession in class ObjectContext<EntityContext>

getStatus

public Status getStatus()
Specified by:
getStatus in class ObjectContext<EntityContext>

getMapper

public ObjectMapper<EntityContext> getMapper()
Specified by:
getMapper in class ObjectContext<EntityContext>

getObject

public java.lang.Object getObject()
Specified by:
getObject in class ObjectContext<EntityContext>

getEntity

public EntityContext getEntity()
Specified by:
getEntity in class ObjectContext<EntityContext>

getTypeInfo

public PrimaryTypeInfo getTypeInfo()
Description copied from class: ObjectContext
Returns the type info associated with the context. Null is returned when the context is in transient state, otherwise the type info of the corresponding node is returned.

Specified by:
getTypeInfo in class ObjectContext<EntityContext>
Returns:
the type info

decodeName

public java.lang.String decodeName(java.lang.String name,
                                   NameKind nameKind)

encodeName

public java.lang.String encodeName(java.lang.String name,
                                   NameKind nameKind)

adapt

public <T> T adapt(java.lang.Class<T> adaptedClass)
Adapts the current object held by this context to the specified type. If the current object is an instance of the specified class then this object is returned otherwise an attempt to find an embedded object of the specified type is performed.

Type Parameters:
T - the parameter type of the adapted class
Parameters:
adaptedClass - the class to adapt to
Returns:
the adapted object or null

addMixin

public void addMixin(EmbeddedContext mixinCtx)

removeMixin

public void removeMixin(java.lang.Class<?> mixinType)

getEmbedded

public EmbeddedContext getEmbedded(java.lang.Class<?> embeddedType)

getAttribute

public java.lang.String getAttribute(NodeAttributeType type)

remove

public void remove()

getReferents

public <T> java.util.Iterator<T> getReferents(java.lang.String name,
                                              java.lang.Class<T> filterClass,
                                              LinkType linkType)

getLocalName

public java.lang.String getLocalName()

getId

public java.lang.String getId()

getPath

public java.lang.String getPath()

setLocalName

public void setLocalName(java.lang.String name)

getReferenced

public EntityContext getReferenced(java.lang.String name,
                                   LinkType linkType)

setReferenced

public void setReferenced(java.lang.String name,
                          EntityContext referencedCtx,
                          LinkType linkType)

addReference

public boolean addReference(java.lang.String name,
                            EntityContext referentCtx,
                            LinkType linkType)

getParent

public EntityContext getParent()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2012 eXo Platform SAS. All Rights Reserved.