Package org.nuiton.topia.persistence
Interface TopiaEntityEnum
- All Superinterfaces:
Serializable
This contract represents a generated entity. It provides some information about the classes for any entity managed
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, 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
- Author:
- Tony Chemit - chemit@codelutin.com
-
Method Summary
Modifier and TypeMethodDescriptionbooleanaccept(Class<? extends TopiaEntity> klass) Test if a given type of entity is matching the contract of this entity.Class<? extends TopiaEntity>Class<? extends TopiaEntity>Note : this is a lazy accessor.String[]String[]booleanbooleanname()This is a convenient method, as entity enum offers this method fromEnum.name().voidsetImplementationFQN(String implementationFQN) Change the implementation class of the entity.
-
Method Details
-
name
String name()This is a convenient method, as entity enum offers this method fromEnum.name().- Returns:
- the name of the underlying entity type.
- Since:
- 2.6.12
-
dbSchemaName
String dbSchemaName()- Returns:
- the name of database schema (null if none was filled).
- Since:
- 2.9.2
-
dbTableName
String dbTableName()- Returns:
- the name of database table
- Since:
- 2.9.2
-
getContract
Class<? extends TopiaEntity> getContract()- Returns:
- the contract class of the entity
-
getImplementation
Class<? extends TopiaEntity> getImplementation()Note : this is a lazy accessor.- Returns:
- the implementation class of the entity
-
getImplementationFQN
String getImplementationFQN()- Returns:
- the fully qualifed name of the implementation class of the entity
-
getNaturalIds
String[] getNaturalIds()- Returns:
- the array of property names involved in the natural key of the entity.
-
getNotNulls
String[] getNotNulls()- Returns:
- the array of property names which are marked as not-null.
- Since:
- 2.6.9
-
isUseNaturalIds
boolean isUseNaturalIds()- Returns:
trueif entity use natural ids,falseotherwise.- Since:
- 2.6.9
-
isUseNotNulls
boolean isUseNotNulls()- Returns:
trueif entity use some not-null properties,falseotherwise.- Since:
- 2.6.9
-
setImplementationFQN
Change the implementation class of the entity. Note : this method should reset all states of the object (implementation class, operators,...).- Parameters:
implementationFQN- the new fully qualified name of the new implementation class of the entity.
-
accept
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 → BXxxEntityEnum.A.accept(Class<A>) → true XxxEntityEnum.A.accept(Class<B>) → false XxxEntityEnum.B.accept(Class<B>) → true XxxEntityEnum.B.accept(Class<A>) → false
- Parameters:
klass- the type of an entity to test.- Returns:
trueif given type is dealed directly by this entity,falseotherwise.
-