|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.javalite.activejdbc.MetaModel
public class MetaModel
| Constructor Summary | |
|---|---|
protected |
MetaModel(String dbName,
Class<? extends Model> modelClass,
String dbType)
|
| Method Summary | ||
|---|---|---|
protected void |
addAssociation(Association association)
|
|
boolean |
cached()
|
|
protected void |
checkAttributeOrAssociation(String attributeOrAssociation)
Checks if this model has a named attribute or association whose target has the same name as argument. |
|
|
getAssociationForTarget(String target)
Returns association of this table with the target table. |
|
|
getAssociationForTarget(String target,
Class<A> associationClass)
Returns association of this table with the target table. |
|
protected List<Association> |
getAssociations()
|
|
List<Association> |
getAssociationsForTarget(String target)
Returns associations of this table with the target table. |
|
protected Set<String> |
getAttributeNames()
Retrieves all attribute names. |
|
Set<String> |
getAttributeNamesSkip(String... names)
Finds all attribute names except those provided as arguments. |
|
Set<String> |
getAttributeNamesSkipGenerated()
Convenience method. |
|
Set<String> |
getAttributeNamesSkipGenerated(boolean managed)
Finds all attribute names except managed like id,
created_at, updated_at and record_version, depending on argument. |
|
Set<String> |
getAttributeNamesSkipId()
Finds all attribute names except for id. |
|
Map<String,ColumnMetadata> |
getColumnMetadata()
Provides column metadata map, keyed by attribute names. |
|
String[] |
getCompositeKeys()
Returns optional composite primary key class |
|
String |
getDbName()
|
|
protected static String |
getDbName(Class<? extends Model> modelClass)
|
|
String |
getDbType()
|
|
Dialect |
getDialect()
|
|
String |
getFKName()
FK name is a foreign key name used in relationships as a foreign key column in a child table (table represented by this instance is a parent table). |
|
String |
getIdGeneratorCode()
|
|
String |
getIdName()
|
|
protected List<Many2ManyAssociation> |
getManyToManyAssociations(List<Association> excludedAssociations)
|
|
Class<? extends Model> |
getModelClass()
|
|
protected List<OneToManyAssociation> |
getOneToManyAssociations(List<Association> exclusions)
|
|
protected List<OneToManyPolymorphicAssociation> |
getPolymorphicAssociations(List<Association> exclusions)
|
|
String |
getTableName()
|
|
String |
getVersionColumn()
|
|
protected boolean |
hasAssociation(String table,
Class<? extends Association> associationClass)
|
|
boolean |
isAssociatedTo(Class<? extends Model> targetModelClass)
Checks if there is association to the target model class., |
|
boolean |
isVersioned()
Returns true if this model supports optimistic locking, false if not |
|
protected boolean |
tableExists()
|
|
String |
toString()
|
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
protected MetaModel(String dbName,
Class<? extends Model> modelClass,
String dbType)
| Method Detail |
|---|
public String getVersionColumn()
public String getIdGeneratorCode()
public String getDbName()
public boolean cached()
public Class<? extends Model> getModelClass()
public String getTableName()
protected boolean tableExists()
public Set<String> getAttributeNamesSkipId()
public Set<String> getAttributeNamesSkipGenerated()
getAttributeNamesSkipGenerated(boolean) and passes true as argument.
public Set<String> getAttributeNamesSkipGenerated(boolean managed)
id,
created_at, updated_at and record_version, depending on argument.
managed - if true, time managed attributes created_at and updated_at will not be included (they are managed automatically).
If false (not managed) created_at and updated_at will be included in output.
id, created_at, updated_at and
record_version, depending on argument.public Set<String> getAttributeNamesSkip(String... names)
public boolean isVersioned()
protected Set<String> getAttributeNames()
public String getIdName()
public String[] getCompositeKeys()
public <A extends Association> A getAssociationForTarget(String target,
Class<A> associationClass)
target - association of this table and the target table.associationClass - class of association in requested.
public <A extends Association> A getAssociationForTarget(String target)
target - association of this table and the target table.
public List<Association> getAssociationsForTarget(String target)
target - association of this table and the target table.
protected void addAssociation(Association association)
protected boolean hasAssociation(String table,
Class<? extends Association> associationClass)
public String toString()
toString in class Objectpublic String getFKName()
Inflector: It is a singular version of this table name plus "_id".
protected List<OneToManyAssociation> getOneToManyAssociations(List<Association> exclusions)
protected List<OneToManyPolymorphicAssociation> getPolymorphicAssociations(List<Association> exclusions)
protected List<Many2ManyAssociation> getManyToManyAssociations(List<Association> excludedAssociations)
public String getDbType()
public Dialect getDialect()
protected List<Association> getAssociations()
protected void checkAttributeOrAssociation(String attributeOrAssociation)
IllegalArgumentException in case it does not find either one.
attributeOrAssociation - name of attribute or association target.protected static String getDbName(Class<? extends Model> modelClass)
public Map<String,ColumnMetadata> getColumnMetadata()
public boolean isAssociatedTo(Class<? extends Model> targetModelClass)
targetModelClass - class of a model that will be checked for association from current model.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||