public class Entity extends java.lang.Object implements HasParsedElement
Schema by Schema.addEntity(String).
Use the various add methods to add entity properties, indexes, and relations to other entities (addToOne, addToMany).
| Modifier and Type | Method and Description |
|---|---|
Property.PropertyBuilder |
addIdProperty()
Adds a standard id property.
|
Entity |
addIndex(io.objectbox.generator.model.Index index)
Adds a new index to the entity.
|
Property.PropertyBuilder |
addProperty(PropertyType propertyType,
java.lang.String propertyName) |
io.objectbox.generator.model.ToManyStandalone |
addToMany(io.objectbox.generator.model.ToManyStandalone toMany,
Entity target)
Adds a (stand-alone) to-many relation (
ToManyStandalone) to another entity. |
io.objectbox.generator.model.ToManyByBacklink |
addToManyByToManyBacklink(io.objectbox.generator.model.ToManyByBacklink toMany,
Entity targetEntity,
io.objectbox.generator.model.ToManyStandalone targetToMany)
Adds a to-many relation based on a (stand-alone) to-many relation (
addToMany(io.objectbox.generator.model.ToManyStandalone, io.objectbox.generator.model.Entity)) from another entity
to this entity. |
io.objectbox.generator.model.ToManyByBacklink |
addToManyByToOneBacklink(io.objectbox.generator.model.ToManyByBacklink toMany,
Entity targetEntity,
io.objectbox.generator.model.ToOne targetToOne)
Adds a to-many relation based on a to-one relation (
addToOne(io.objectbox.generator.model.ToOne, io.objectbox.generator.model.Entity)) from another entity to this entity. |
io.objectbox.generator.model.ToOne |
addToOne(io.objectbox.generator.model.ToOne toOne,
Entity target)
Adds a to-one relationship to the given target entity.
|
void |
computeEntityFlags()
Based on this entities attributes computes required
EntityFlags. |
Property |
findPropertyByName(java.lang.String name) |
java.util.Collection<java.lang.String> |
getAdditionalImportsDao() |
java.lang.String |
getClassName() |
java.lang.String |
getClassNameDao() |
java.lang.String |
getDbName() |
int |
getEntityFlags()
Returns combined
EntityFlags value. |
java.lang.Integer |
getEntityFlagsForModelFile()
Returns combined
EntityFlags value of only those flags
that should be stored in the model file. |
java.util.Set<java.lang.String> |
getEntityFlagsNames()
Returns names of
EntityFlags. |
boolean |
getHasBoxStoreField() |
java.util.List<ToManyBase> |
getIncomingToManyRelations() |
java.util.List<io.objectbox.generator.model.Index> |
getIndexes() |
java.lang.String |
getJavaPackage() |
java.lang.String |
getJavaPackageDao() |
io.objectbox.generator.IdUid |
getLastPropertyId() |
java.lang.Integer |
getModelId() |
java.lang.Long |
getModelUid() |
java.util.List<io.objectbox.generator.model.Index> |
getMultiIndexes() |
java.lang.Object |
getParsedElement() |
Property |
getPkProperty()
Internal property used by templates, don't use during entity definition.
|
java.lang.String |
getPkType()
Internal property used by templates, don't use during entity definition.
|
java.util.List<Property> |
getProperties() |
java.util.List<Property> |
getPropertiesColumns() |
java.util.List<Property> |
getPropertiesPk()
Internal property used by templates, don't use during entity definition.
|
Schema |
getSchema() |
java.util.List<ToManyBase> |
getToManyRelations() |
java.util.List<io.objectbox.generator.model.ToOne> |
getToOneRelations() |
boolean |
hasAllArgsConstructor() |
boolean |
hasRelations() |
protected void |
init2ndPassNamesWithDefaults() |
boolean |
isSyncEnabled() |
boolean |
isSyncSharedGlobalIds() |
void |
setClassNameDao(java.lang.String classNameDao) |
void |
setDbName(java.lang.String dbName) |
void |
setHasAllArgsConstructor(boolean hasAllArgsConstructor)
Set to indicate the associated class has a constructor with an argument for every property available.
|
void |
setHasBoxStoreField(boolean hasBoxStoreField) |
void |
setJavaPackage(java.lang.String javaPackage) |
void |
setJavaPackageDao(java.lang.String javaPackageDao) |
Entity |
setLastPropertyId(io.objectbox.generator.IdUid lastPropertyId) |
Entity |
setModelId(java.lang.Integer modelId) |
Entity |
setModelUid(java.lang.Long modelUid) |
void |
setParsedElement(java.lang.Object parsedElement) |
void |
setSyncEnabled(boolean syncEnabled) |
void |
setSyncSharedGlobalIds(boolean enabled) |
java.lang.String |
toString() |
public Entity setModelId(java.lang.Integer modelId)
public java.lang.Integer getModelId()
public Entity setModelUid(java.lang.Long modelUid)
public java.lang.Long getModelUid()
public io.objectbox.generator.IdUid getLastPropertyId()
public Entity setLastPropertyId(io.objectbox.generator.IdUid lastPropertyId)
public Property.PropertyBuilder addProperty(PropertyType propertyType, java.lang.String propertyName) throws ModelException
ModelExceptionpublic Property.PropertyBuilder addIdProperty() throws ModelException
ModelExceptionpublic io.objectbox.generator.model.ToManyByBacklink addToManyByToOneBacklink(io.objectbox.generator.model.ToManyByBacklink toMany,
Entity targetEntity,
io.objectbox.generator.model.ToOne targetToOne)
throws ModelException
addToOne(io.objectbox.generator.model.ToOne, io.objectbox.generator.model.Entity)) from another entity to this entity.ModelException - if this entity already has a property or relation with name.public io.objectbox.generator.model.ToManyByBacklink addToManyByToManyBacklink(io.objectbox.generator.model.ToManyByBacklink toMany,
Entity targetEntity,
io.objectbox.generator.model.ToManyStandalone targetToMany)
throws ModelException
addToMany(io.objectbox.generator.model.ToManyStandalone, io.objectbox.generator.model.Entity)) from another entity
to this entity.ModelException - if this entity already has a property or relation with name.public io.objectbox.generator.model.ToManyStandalone addToMany(io.objectbox.generator.model.ToManyStandalone toMany,
Entity target)
throws ModelException
ToManyStandalone) to another entity.ModelException - if this entity already has a property or relation with name.public io.objectbox.generator.model.ToOne addToOne(io.objectbox.generator.model.ToOne toOne,
Entity target)
throws ModelException
ModelException - if this entity already has a property or relation with name.public Entity addIndex(io.objectbox.generator.model.Index index)
public Schema getSchema()
public java.lang.String getDbName()
public void setDbName(java.lang.String dbName)
public java.lang.String getClassName()
public java.util.List<Property> getProperties()
public Property findPropertyByName(java.lang.String name)
public java.util.List<Property> getPropertiesColumns()
public java.lang.String getJavaPackage()
public void setJavaPackage(java.lang.String javaPackage)
public java.lang.String getJavaPackageDao()
public void setJavaPackageDao(java.lang.String javaPackageDao)
public java.lang.String getClassNameDao()
public void setClassNameDao(java.lang.String classNameDao)
public java.util.List<Property> getPropertiesPk()
public Property getPkProperty()
public java.util.List<io.objectbox.generator.model.Index> getIndexes()
public java.lang.String getPkType()
public boolean hasAllArgsConstructor()
public void setHasAllArgsConstructor(boolean hasAllArgsConstructor)
public boolean hasRelations()
public java.util.List<io.objectbox.generator.model.ToOne> getToOneRelations()
public java.util.List<ToManyBase> getToManyRelations()
public java.util.List<ToManyBase> getIncomingToManyRelations()
public java.util.Collection<java.lang.String> getAdditionalImportsDao()
public boolean getHasBoxStoreField()
public void setHasBoxStoreField(boolean hasBoxStoreField)
protected void init2ndPassNamesWithDefaults()
public java.util.List<io.objectbox.generator.model.Index> getMultiIndexes()
public java.lang.Object getParsedElement()
getParsedElement in interface HasParsedElementpublic void setParsedElement(java.lang.Object parsedElement)
setParsedElement in interface HasParsedElementpublic boolean isSyncEnabled()
public void setSyncEnabled(boolean syncEnabled)
public boolean isSyncSharedGlobalIds()
public void setSyncSharedGlobalIds(boolean enabled)
public void computeEntityFlags()
EntityFlags.public int getEntityFlags()
EntityFlags value.@Nullable public java.lang.Integer getEntityFlagsForModelFile()
EntityFlags value of only those flags
that should be stored in the model file. Returns null if there would be no flags.public java.util.Set<java.lang.String> getEntityFlagsNames()
EntityFlags.public java.lang.String toString()
toString in class java.lang.Object