Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
import static;
import static;

This is the table name converter used by the Active Objects plugin. It works according to the following:

  • If the entity interface is annotated with then the value of the annotation is used as the base for naming.
  • Otherwise the simple class name is used.
Then the following transformations are applied, in order:
  1. The base name is transform from camel case to under score and upper case. e.q. MyEntity becomes MY_ENTITY.
  2. 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 annotation to your advantage. For example, one could refactor the following entity:

     public interface MyEntity {}
     public interface YourEntity {}
public final class AtlassianTableNameConverter implements TableNameConverter
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
    private final TableNameConverter tableNameConverter;
        // this the basic conversion we want, under score and upper case
        final UnderscoreTableNameConverter baseConverter = new UnderscoreTableNameConverter(.);
                new PrefixedTableNameConverter(
                        new TableAnnotationTableNameConverter(baseConverterbaseConverter));
    public String getName(Class<? extends RawEntity<?>> entityClass)
        final String name = .getName(entityClass);
                "Invalid entity, generated table name (" + name + ") for '" + entityClass.getName() + "' is too long! " +
                        "It should be no longer than " + . + " chars.");
        .debug("Table name for '{}' is '{}'"entityClass.getName(), name);
        return name;
New to GrepCode? Check out our FAQ X