org.nuiton.topia.persistence
Interface TopiaEntityEnum


public interface TopiaEntityEnum

The contract to be realised by the generated enumeration in any DAOHelper. Example : for a model Test, we will have a TestDOAHelper.TestEntityEnum enumeration generated. The contract gives some informations about the classes for any entity dealed by the dao helper. More precisely : - contract class of the entity (this must be an interface class) - the implementation fqn class of an entity (at generation time, we might not have the implementation class) - the implementation class (will be looked up at runtime execution, in that way we make possible to used a different implementation at runtime. - a method to accept any TopiaEntity class for this entity description

Since:
2.2.0
Version:
$Id: TopiaEntityEnum.java 2079 2010-07-18 16:51:11Z tchemit $
Author:
tchemit

Method Summary
 boolean accept(java.lang.Class<? extends TopiaEntity> klass)
          Test if a given type of entity is matching the contract of this entity.
 java.lang.Class<? extends TopiaEntity> getContract()
           
 java.lang.Class<? extends TopiaEntity> getImplementation()
          Note : this is a lazy accessor.
 java.lang.String getImplementationFQN()
           
 java.lang.String[] getNaturalIds()
           
 void setImplementationFQN(java.lang.String implementationFQN)
          Change the implementation class of the entity.
 

Method Detail

getContract

java.lang.Class<? extends TopiaEntity> getContract()
Returns:
the contract class of the entity

getImplementation

java.lang.Class<? extends TopiaEntity> getImplementation()
Note : this is a lazy accessor.

Returns:
the implementation class of the entity

getImplementationFQN

java.lang.String getImplementationFQN()
Returns:
the fully qualifed name of the implementation class of the entity

getNaturalIds

java.lang.String[] getNaturalIds()
Returns:
the array of property names involved in the natural key of the entity.

setImplementationFQN

void setImplementationFQN(java.lang.String implementationFQN)
Change the implementation class of the entity. Note : this method should reset all states of the objet (implementation class, operators,...).

Parameters:
implementationFQN - the new fully qualifed name of the new implementation class of the entity.

accept

boolean accept(java.lang.Class<? extends TopiaEntity> klass)
Test if a given type of entity is matching the contract of this entity. Note : make sure to accept type only on the given contract class of this entity, can not accept an ancestor type, since there is a specific contract for this. Example : A -> B
 EntityEnum.A.accept(Class) -> true
 EntityEnum.A.accept(Class) -> false
 EntityEnum.B.accept(Class) -> true
 EntityEnum.B.accept(Class) -> false
 

Parameters:
klass - the type of an entity to test.
Returns:
true if given type is dealed directly by this entity, false otherwise.


Copyright © 2004-2010 CodeLutin. All Rights Reserved.