net.java.ao.atlassian.PrefixedTableNameConverter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of activeobjects Show documentation
Show all versions of activeobjects Show documentation
This is the full Active Objects library, if you don't know which one to use, you probably want this one.
The newest version!
package net.java.ao.atlassian;
import net.java.ao.RawEntity;
import net.java.ao.schema.TableNameConverter;
import java.util.Objects;
/**
* A {@link net.java.ao.schema.TableNameConverter table name converter} that will prepend the given {@link Prefix} to table names.
* It uses a {@link net.java.ao.schema.TableNameConverter delegate table name converter} for the general conversion strategy.
*/
final class PrefixedTableNameConverter implements TableNameConverter {
private final TablePrefix prefix;
/**
* The table name converter we delegate the real conversion to
*/
private final TableNameConverter delegate;
public PrefixedTableNameConverter(TablePrefix prefix, TableNameConverter delegate) {
this.prefix = Objects.requireNonNull(prefix, "prefix can't be null");
this.delegate = Objects.requireNonNull(delegate, "delegate can't be null");
}
public String getName(Class extends RawEntity>> clazz) {
return prefix.prepend(delegate.getName(clazz));
}
}