net.java.ao.atlassian
Class AtlassianTableNameConverter
java.lang.Object
net.java.ao.atlassian.AtlassianTableNameConverter
- All Implemented Interfaces:
- TableNameConverter
public final class AtlassianTableNameConverter
- extends Object
- implements TableNameConverter
This is the table name converter used by the Active Objects plugin. It works according to the following:
Then the following transformations are applied, in order:
- The base name is transform from camel case to under score and upper case. e.q.
MyEntity
becomes
MY_ENTITY
.
- The
prefix
is then applied, using its prepend
method.
This means that if you refactor your entities and don't want to have to upgrade the database tables used behind
the scene, you can use the Table
annotation to your advantage. For example, one could
refactor the following entity:
public interface MyEntity {}
to
@Table("MyEntity")
public interface YourEntity {}
Method Summary |
String |
getName(Class<? extends RawEntity<?>> entityClass)
Generates a table name to correspond with the specified class. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AtlassianTableNameConverter
public AtlassianTableNameConverter(TablePrefix prefix)
getName
public String getName(Class<? extends RawEntity<?>> entityClass)
- Description copied from interface:
TableNameConverter
- Generates a table name to correspond with the specified class. The
algorithm used must check for the existance of the
Table
annotation and use the appropriate override when necessary. If this
check is not made, ActiveObjects will continue to function normally,
but any code assuming the proper imlementation of @Table
will likely fail.
- Specified by:
getName
in interface TableNameConverter
- Parameters:
entityClass
- The entity type for which a corresponding field name must be
generated.
- Returns:
- A database table name which corresponds to the given entity type.
Copyright © 2007-2014. All Rights Reserved.