public class Property extends java.lang.Object implements HasParsedElement
| Modifier and Type | Class and Description |
|---|---|
static class |
Property.PropertyBuilder |
| Constructor and Description |
|---|
Property(Schema schema,
Entity entity,
PropertyType propertyType,
java.lang.String propertyName) |
| Modifier and Type | Method and Description |
|---|---|
void |
computePropertyFlags()
Based on this properties attributes computes required
PropertyFlags. |
java.lang.String |
getConverter() |
java.lang.String |
getConverterClassName() |
java.lang.String |
getCustomType() |
java.lang.String |
getCustomTypeClassName() |
java.lang.String |
getDatabaseValueExpression() |
java.lang.String |
getDatabaseValueExpression(java.lang.String entityValue) |
java.lang.String |
getDbName() |
java.lang.String |
getDbType()
String representation of a
PropertyType enum. |
java.lang.Short |
getDbTypeId()
ID of the
PropertyType. |
Entity |
getEntity() |
java.lang.String |
getGetterMethodName() |
io.objectbox.generator.model.HnswParams |
getHnswParams() |
java.lang.String |
getHnswParamsExpression() |
io.objectbox.generator.model.Index |
getIndex()
Note: index is not set until after finishing schema.
|
java.lang.String |
getJavaRawType()
If the Java type is generic, returns the raw type.
|
java.lang.String |
getJavaType()
Returns the type including type parameters, e.g.
|
java.lang.String |
getJavaTypeInEntity() |
io.objectbox.generator.IdUid |
getModelId() |
io.objectbox.generator.IdUid |
getModelIndexId() |
int |
getOrdinal() |
java.lang.Object |
getParsedElement() |
java.util.Set<java.lang.String> |
getPropertyFlagsForGeneratedCode()
Returns names of
PropertyFlags to be used in generated model builder code. |
java.lang.Integer |
getPropertyFlagsForModelFile()
Returns combined
PropertyFlags value of only those flags
that should be stored in the model file. |
java.lang.String |
getPropertyName() |
PropertyType |
getPropertyType() |
java.lang.String |
getSetValueExpression(java.lang.String value) |
Entity |
getTargetEntity() |
java.lang.String |
getValueExpression() |
java.lang.String |
getVirtualTargetName() |
java.lang.String |
getVirtualTargetValueExpression() |
boolean |
hasHnswParams() |
boolean |
isIdAssignable()
If
PropertyFlags.ID_SELF_ASSIGNABLE should be set on this property. |
boolean |
isIdCompanion()
If
PropertyFlags.ID_COMPANION should be set on this property. |
boolean |
isList()
For a vector property, if it is a
List or an array. |
boolean |
isNonPrimitiveFlag()
If
PropertyFlags.NON_PRIMITIVE_TYPE should be set on this property. |
boolean |
isNotNullFlag()
If
PropertyFlags.NOT_NULL should be set on this property. |
boolean |
isPrimaryKey()
If this property is a primary key and
PropertyFlags.ID should be set. |
boolean |
isTypeNotNull()
If a property value may never be null, so e.g.
|
boolean |
isUnsigned()
If
PropertyFlags.UNSIGNED should be set on this property. |
boolean |
isVirtual()
If this property does not actually exist in the entity class, but only in the model
and
PropertyFlags.VIRTUAL should be set. |
void |
setIndex(io.objectbox.generator.model.Index index) |
void |
setModelId(io.objectbox.generator.IdUid modelId) |
void |
setModelIndexId(io.objectbox.generator.IdUid modelIndexId) |
void |
setParsedElement(java.lang.Object parsedElement) |
java.lang.String |
toString() |
public Property(Schema schema, Entity entity, PropertyType propertyType, java.lang.String propertyName)
public java.lang.String getPropertyName()
public PropertyType getPropertyType()
public io.objectbox.generator.IdUid getModelId()
public void setModelId(io.objectbox.generator.IdUid modelId)
public io.objectbox.generator.IdUid getModelIndexId()
public void setModelIndexId(io.objectbox.generator.IdUid modelIndexId)
public java.lang.String getDbName()
public java.lang.String getDbType()
PropertyType enum.public java.lang.Short getDbTypeId()
PropertyType.public boolean isPrimaryKey()
PropertyFlags.ID should be set.public boolean isIdCompanion()
PropertyFlags.ID_COMPANION should be set on this property.public boolean isTypeNotNull()
Note: this is not related to PropertyFlags.NOT_NULL, use isNotNullFlag() instead.
public boolean isNotNullFlag()
PropertyFlags.NOT_NULL should be set on this property.
Note: this does not indicate if the property value may never be null,
use isTypeNotNull() instead.
public boolean isNonPrimitiveFlag()
PropertyFlags.NON_PRIMITIVE_TYPE should be set on this property.
This will indicate to the database that either
Note: use isTypeNotNull() instead to check if the property value can be null.
public boolean isList()
List or an array.
Currently only supported for PropertyType.StringArray.
public boolean isUnsigned()
PropertyFlags.UNSIGNED should be set on this property.public boolean isIdAssignable()
PropertyFlags.ID_SELF_ASSIGNABLE should be set on this property.public java.lang.String getJavaType()
List<String>.public java.lang.String getJavaRawType()
List instead of List<String>.
Otherwise, returns the same as getJavaType().public java.lang.String getJavaTypeInEntity()
public int getOrdinal()
public java.lang.String getCustomType()
public java.lang.String getCustomTypeClassName()
public java.lang.String getConverter()
public java.lang.String getConverterClassName()
public boolean isVirtual()
PropertyFlags.VIRTUAL should be set.public java.lang.String getVirtualTargetValueExpression()
public java.lang.String getVirtualTargetName()
public java.lang.String getGetterMethodName()
public Entity getTargetEntity()
public java.lang.String getValueExpression()
public java.lang.String getSetValueExpression(java.lang.String value)
public java.lang.String getDatabaseValueExpression()
public java.lang.String getDatabaseValueExpression(java.lang.String entityValue)
@Nullable public io.objectbox.generator.model.HnswParams getHnswParams()
public boolean hasHnswParams()
public java.lang.String getHnswParamsExpression()
HnswParams.getExpression().public Entity getEntity()
@Nullable public io.objectbox.generator.model.Index getIndex()
public void setIndex(io.objectbox.generator.model.Index index)
public java.lang.Object getParsedElement()
getParsedElement in interface HasParsedElementpublic void setParsedElement(java.lang.Object parsedElement)
setParsedElement in interface HasParsedElementpublic void computePropertyFlags()
PropertyFlags.@Nullable public java.lang.Integer getPropertyFlagsForModelFile()
PropertyFlags value of only those flags
that should be stored in the model file. Returns null if there would be no flags.
These may be different from getPropertyFlagsForGeneratedCode(), see computePropertyFlags().
public java.util.Set<java.lang.String> getPropertyFlagsForGeneratedCode()
PropertyFlags to be used in generated model builder code.
These may be different from getPropertyFlagsForModelFile(), see computePropertyFlags().
public java.lang.String toString()
toString in class java.lang.Object