de.greenrobot.daogenerator
Class Entity

java.lang.Object
  extended by de.greenrobot.daogenerator.Entity

public class Entity
extends java.lang.Object

    

Model class for an entity: a Java data object mapped to a data base table. A new entity is added to a Schema by the method Schema.addEntity(String) (there is no public constructor for Entity itself).

Use the various addXXX methods to add entity properties, indexes, and relations to other entities (addToOne, addToMany).

There are further configuration possibilities:

See Also:
Modelling Entities (Documentation page), Relations (Documentation page)

Method Summary
 Property.PropertyBuilder addBooleanProperty(java.lang.String propertyName)
           
 Property.PropertyBuilder addByteArrayProperty(java.lang.String propertyName)
           
 Property.PropertyBuilder addByteProperty(java.lang.String propertyName)
           
 Property.PropertyBuilder addDateProperty(java.lang.String propertyName)
           
 Property.PropertyBuilder addDoubleProperty(java.lang.String propertyName)
           
 Property.PropertyBuilder addFloatProperty(java.lang.String propertyName)
           
 Property.PropertyBuilder addIdProperty()
          Adds a standard _id column required by standard Android classes, e.g. list adapters.
protected  void addIncomingToMany(ToMany toMany)
           
 Entity addIndex(Index index)
          Adds a new index to the entity.
 Property.PropertyBuilder addIntProperty(java.lang.String propertyName)
           
 Property.PropertyBuilder addLongProperty(java.lang.String propertyName)
           
 Property.PropertyBuilder addProperty(PropertyType propertyType, java.lang.String propertyName)
           
 Property.PropertyBuilder addShortProperty(java.lang.String propertyName)
           
 Property.PropertyBuilder addStringProperty(java.lang.String propertyName)
           
 ToMany addToMany(Entity target, Property targetProperty)
          Adds a to-many relationship; the target entity is joined to the PK property of this entity (typically the ID).
 ToMany addToMany(Entity target, Property targetProperty, java.lang.String name)
          Convenience method for addToMany(Entity, Property) with a subsequent call to ToMany.setName(String).
 ToMany addToMany(Property[] sourceProperties, Entity target, Property[] targetProperties)
           
 ToMany addToMany(Property sourceProperty, Entity target, Property targetProperty)
          Add a to-many relationship; the target entity is joined using the given target property (of the target entity) and given source property (of this entity).
 ToOne addToOne(Entity target, Property fkProperty)
          Adds a to-one relationship to the given target entity using the given given foreign key property (which belongs to this entity).
 ToOne addToOne(Entity target, Property fkProperty, java.lang.String name)
          Convenience for addToOne(Entity, Property) with a subsequent call to ToOne.setName(String).
 ToOne addToOneWithoutProperty(java.lang.String name, Entity target, java.lang.String fkColumnName)
           
 ToOne addToOneWithoutProperty(java.lang.String name, Entity target, java.lang.String fkColumnName, boolean notNull, boolean unique)
           
 java.lang.Boolean getActive()
           
 java.util.Collection getAdditionalImportsDao()
           
 java.util.Collection getAdditionalImportsEntity()
           
 java.lang.String getClassName()
           
 java.lang.String getClassNameDao()
           
 java.lang.String getClassNameTest()
           
 java.lang.Boolean getHasKeepSections()
           
 java.util.List<ToMany> getIncomingToManyRelations()
           
 java.util.List<Index> getIndexes()
           
 java.util.List getInterfacesToImplement()
           
 java.lang.String getJavaPackage()
           
 java.lang.String getJavaPackageDao()
           
 java.lang.String getJavaPackageTest()
           
 Property getPkProperty()
           
 java.lang.String getPkType()
           
 java.util.List<Property> getProperties()
           
 java.util.List<Property> getPropertiesColumns()
           
 java.util.List<Property> getPropertiesNonPk()
           
 java.util.List<Property> getPropertiesPk()
           
 Schema getSchema()
           
 java.lang.String getSuperclass()
           
 java.lang.String getTableName()
           
 java.util.List<ToMany> getToManyRelations()
           
 java.util.List<ToOne> getToOneRelations()
           
 void implementsInterface(java.lang.String... interfaces)
           
 void implementsSerializable()
           
protected  void init2ndPassIndexNamesWithDefaults()
           
protected  void init2nPassNamesWithDefaults()
           
 boolean isConstructors()
           
 boolean isProtobuf()
           
 boolean isSkipGeneration()
           
 boolean isSkipGenerationTest()
           
 void setActive(java.lang.Boolean active)
          Entities with relations are active, but this method allows to make the entities active even if it does not have relations.
 void setClassNameDao(java.lang.String classNameDao)
           
 void setClassNameTest(java.lang.String classNameTest)
           
 void setConstructors(boolean constructors)
           
 void setHasKeepSections(java.lang.Boolean hasKeepSections)
           
 void setJavaPackage(java.lang.String javaPackage)
           
 void setJavaPackageDao(java.lang.String javaPackageDao)
           
 void setJavaPackageTest(java.lang.String javaPackageTest)
           
 void setSkipGeneration(boolean skipGeneration)
          Flag if the entity's code generation should be skipped.
 void setSkipGenerationTest(boolean skipGenerationTest)
           
 void setSuperclass(java.lang.String classToExtend)
           
 void setTableName(java.lang.String tableName)
           
 java.lang.String toString()
           
 void validatePropertyExists(Property property)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

addBooleanProperty

public Property.PropertyBuilder addBooleanProperty(java.lang.String propertyName)

addByteProperty

public Property.PropertyBuilder addByteProperty(java.lang.String propertyName)

addShortProperty

public Property.PropertyBuilder addShortProperty(java.lang.String propertyName)

addIntProperty

public Property.PropertyBuilder addIntProperty(java.lang.String propertyName)

addLongProperty

public Property.PropertyBuilder addLongProperty(java.lang.String propertyName)

addFloatProperty

public Property.PropertyBuilder addFloatProperty(java.lang.String propertyName)

addDoubleProperty

public Property.PropertyBuilder addDoubleProperty(java.lang.String propertyName)

addByteArrayProperty

public Property.PropertyBuilder addByteArrayProperty(java.lang.String propertyName)

addStringProperty

public Property.PropertyBuilder addStringProperty(java.lang.String propertyName)

addDateProperty

public Property.PropertyBuilder addDateProperty(java.lang.String propertyName)

addProperty

public Property.PropertyBuilder addProperty(PropertyType propertyType,
                                            java.lang.String propertyName)

addIdProperty

public Property.PropertyBuilder addIdProperty()
Adds a standard _id column required by standard Android classes, e.g. list adapters.


addToMany

public ToMany addToMany(Entity target,
                        Property targetProperty)
Adds a to-many relationship; the target entity is joined to the PK property of this entity (typically the ID).


addToMany

public ToMany addToMany(Entity target,
                        Property targetProperty,
                        java.lang.String name)
Convenience method for addToMany(Entity, Property) with a subsequent call to ToMany.setName(String).


addToMany

public ToMany addToMany(Property sourceProperty,
                        Entity target,
                        Property targetProperty)
Add a to-many relationship; the target entity is joined using the given target property (of the target entity) and given source property (of this entity).


addToMany

public ToMany addToMany(Property[] sourceProperties,
                        Entity target,
                        Property[] targetProperties)

addToOne

public ToOne addToOne(Entity target,
                      Property fkProperty)
Adds a to-one relationship to the given target entity using the given given foreign key property (which belongs to this entity).


addToOne

public ToOne addToOne(Entity target,
                      Property fkProperty,
                      java.lang.String name)
Convenience for addToOne(Entity, Property) with a subsequent call to ToOne.setName(String).


addToOneWithoutProperty

public ToOne addToOneWithoutProperty(java.lang.String name,
                                     Entity target,
                                     java.lang.String fkColumnName)

addToOneWithoutProperty

public ToOne addToOneWithoutProperty(java.lang.String name,
                                     Entity target,
                                     java.lang.String fkColumnName,
                                     boolean notNull,
                                     boolean unique)

addIncomingToMany

protected void addIncomingToMany(ToMany toMany)

addIndex

public Entity addIndex(Index index)
Adds a new index to the entity.


isProtobuf

public boolean isProtobuf()

getSchema

public Schema getSchema()

getTableName

public java.lang.String getTableName()

setTableName

public void setTableName(java.lang.String tableName)

getClassName

public java.lang.String getClassName()

getProperties

public java.util.List<Property> getProperties()

getPropertiesColumns

public java.util.List<Property> getPropertiesColumns()

getJavaPackage

public java.lang.String getJavaPackage()

setJavaPackage

public void setJavaPackage(java.lang.String javaPackage)

getJavaPackageDao

public java.lang.String getJavaPackageDao()

setJavaPackageDao

public void setJavaPackageDao(java.lang.String javaPackageDao)

getClassNameDao

public java.lang.String getClassNameDao()

setClassNameDao

public void setClassNameDao(java.lang.String classNameDao)

getClassNameTest

public java.lang.String getClassNameTest()

setClassNameTest

public void setClassNameTest(java.lang.String classNameTest)

getJavaPackageTest

public java.lang.String getJavaPackageTest()

setJavaPackageTest

public void setJavaPackageTest(java.lang.String javaPackageTest)

getPropertiesPk

public java.util.List<Property> getPropertiesPk()

getPropertiesNonPk

public java.util.List<Property> getPropertiesNonPk()

getPkProperty

public Property getPkProperty()

getIndexes

public java.util.List<Index> getIndexes()

getPkType

public java.lang.String getPkType()

isConstructors

public boolean isConstructors()

setConstructors

public void setConstructors(boolean constructors)

isSkipGeneration

public boolean isSkipGeneration()

setSkipGeneration

public void setSkipGeneration(boolean skipGeneration)
Flag if the entity's code generation should be skipped. E.g. if you need to change the class after initial generation.


isSkipGenerationTest

public boolean isSkipGenerationTest()

setSkipGenerationTest

public void setSkipGenerationTest(boolean skipGenerationTest)

getToOneRelations

public java.util.List<ToOne> getToOneRelations()

getToManyRelations

public java.util.List<ToMany> getToManyRelations()

getIncomingToManyRelations

public java.util.List<ToMany> getIncomingToManyRelations()

setActive

public void setActive(java.lang.Boolean active)
Entities with relations are active, but this method allows to make the entities active even if it does not have relations.


getActive

public java.lang.Boolean getActive()

getHasKeepSections

public java.lang.Boolean getHasKeepSections()

getAdditionalImportsEntity

public java.util.Collection getAdditionalImportsEntity()

getAdditionalImportsDao

public java.util.Collection getAdditionalImportsDao()

setHasKeepSections

public void setHasKeepSections(java.lang.Boolean hasKeepSections)

getInterfacesToImplement

public java.util.List getInterfacesToImplement()

implementsInterface

public void implementsInterface(java.lang.String... interfaces)

implementsSerializable

public void implementsSerializable()

getSuperclass

public java.lang.String getSuperclass()

setSuperclass

public void setSuperclass(java.lang.String classToExtend)

init2nPassNamesWithDefaults

protected void init2nPassNamesWithDefaults()

init2ndPassIndexNamesWithDefaults

protected void init2ndPassIndexNamesWithDefaults()

validatePropertyExists

public void validatePropertyExists(Property property)

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2011-2012 greenrobot.de. All Rights Reserved.