public class Property extends RMObject implements java.lang.Comparable, RMJSONArchiver.GetKeys, Archivable
Modifier and Type | Class and Description |
---|---|
static class |
Property.DateType |
static class |
Property.NumberType |
static class |
Property.StringSize |
static class |
Property.Type |
Constructor and Description |
---|
Property()
Creates a new property.
|
Property(java.lang.String aName)
Creates a new property with given name.
|
Property(java.lang.String aName,
java.lang.Object aType)
Creates a new property with given name and type.
|
Property(java.lang.String aName,
Property.Type aType)
Creates a new property with given name and type.
|
Modifier and Type | Method and Description |
---|---|
Property |
clone()
Standard clone implementation.
|
int |
compareTo(java.lang.Object anObj)
Implements comparable to compare based on name.
|
java.lang.Object |
convertValue(java.lang.Object anObj)
Converts an arbitrary object to property type.
|
boolean |
equals(java.lang.Object anObj)
Standard equals implementation.
|
Property |
fromXML(RXArchiver anArchiver,
RXElement anElement)
XML unarchival.
|
Property.DateType |
getDateType()
Returns the date type.
|
Property.DateType |
getDateTypeDefault()
Returns the default date type.
|
java.lang.Object |
getDefaultValue()
Returns default value for this property.
|
Entity |
getEntity()
Returns the entity that owns this property.
|
java.lang.String |
getEnumsString()
Returns the enum strings as a single string (comma separated).
|
java.util.List<java.lang.String> |
getEnumStrings()
Returns the enum strings (for type Enum).
|
java.util.List<java.lang.String> |
getJSONKeys()
Returns JSON keys.
|
java.lang.Object |
getKeyValue(java.lang.String aKey)
RMKey.Get implementation to return Property for key from RelationEntity (if found).
|
java.lang.String |
getName()
Returns the name of this property.
|
boolean |
getNullableDefault()
Returns the nullable default.
|
Property.NumberType |
getNumberType()
Returns the number type.
|
Property.NumberType |
getNumberTypeDefault()
Return default number type.
|
Entity |
getRelationEntity()
Returns the relation entity.
|
java.lang.String |
getRelationEntityName()
Returns the name of the entity that this relation property points to.
|
Property |
getRelationLocalProperty()
Returns the relation local property.
|
java.lang.String |
getRelationLocalPropertyName()
Returns the property name local to this property's entity that the relation uses as a key (primary or foreign).
|
Property |
getRelationRemoteProperty()
Returns the relation remote property.
|
java.lang.String |
getRelationRemotePropertyName()
Returns the property name that the relation uses as a key in the remote table (primary or foreign).
|
java.lang.String |
getStandardName()
Returns the name in a standard format (strip is/get prefix and start with capital letter).
|
Property.StringSize |
getStringSize()
Returns the string size.
|
Property.StringSize |
getStringSizeDefault()
Return default string size.
|
Property.Type |
getType()
Returns the type of this property.
|
boolean |
isAttribute()
Returns whether this property is a simple attribute.
|
boolean |
isAutoGenerated()
Returns whether column is automatically generated (numbered), thus read-only.
|
boolean |
isDerived()
Returns whether property value is derived from other properties and doesn't require persistence.
|
boolean |
isNullable()
Returns whether property allows nulls.
|
boolean |
isPrimary()
Returns whether this property is a primary key.
|
boolean |
isPrivate()
Returns whether this property is private.
|
boolean |
isRelation()
Returns whether this property is a relation.
|
boolean |
isToMany()
Returns whether this property is a to many relation.
|
void |
setAutoGenerated(boolean aValue)
Sets whether column is automatically generated (numbered), thus read-only.
|
void |
setDateType(Property.DateType aDateType)
Sets the date type.
|
void |
setDefaultValue(java.lang.Object aValue)
Sets default value for this property.
|
void |
setEntity(Entity anEntity)
Sets the entity that owns this property.
|
void |
setEnumsString(java.lang.String aValue)
Sets the enum strings as a single string (comma separated).
|
void |
setEnumStrings(java.util.List<java.lang.String> theValues)
Sets the enum strings (for type Enum).
|
void |
setName(java.lang.String aName)
Sets the name of this property.
|
void |
setNullable(boolean aValue)
Sets whether property allows nulls.
|
void |
setNumberType(Property.NumberType aNumberType)
Sets the number type.
|
void |
setPrimary(boolean isPrimary)
Sets whether this property is a primary key.
|
void |
setPrivate(boolean isPrivate)
Sets whether this property is private.
|
void |
setRelationEntity(Entity anEntity)
Sets the relation entity.
|
void |
setRelationEntityName(java.lang.String aName)
Sets the name of the entity that this relation property points to.
|
void |
setRelationLocalPropertyName(java.lang.String aName)
Sets the property name local to this property's entity that the relation uses as a key (primary or foreign).
|
void |
setRelationRemotePropertyName(java.lang.String aName)
Sets the property name that the relation uses as a key in the remote table (primary or foreign).
|
void |
setStringSize(Property.StringSize aSize)
Sets the string size.
|
void |
setToMany(boolean aValue)
Sets whether this property is a to many relation.
|
void |
setType(Property.Type aType)
Sets the type of this property.
|
void |
setTypeFromSample(java.lang.String aSample)
Sets property type from sample string - tries to discern whether string represents a date or number.
|
void |
setTypeName(java.lang.String aName)
Sets the type from a given name.
|
java.lang.String |
toString()
Returns a string representation of this property (its name).
|
java.lang.String |
toString(java.lang.Object aValue)
Returns a string representation of given value according to property type.
|
RXElement |
toXML(RXArchiver anArchiver)
XML archival.
|
addPropertyChangeListener, animUpdate, firePropertyChange, firePropertyChange, firePropertyChange, getPCEvent, removePropertyChangeListener, sendPropertyChange
addListener, getListener, getListenerCount, getListenerCount, getListenerList, getListeners, hasListeners, removeListener
public Property()
public Property(java.lang.String aName)
public Property(java.lang.String aName, Property.Type aType)
public Property(java.lang.String aName, java.lang.Object aType)
public Entity getEntity()
public void setEntity(Entity anEntity)
public java.lang.String getName()
public void setName(java.lang.String aName)
public java.lang.String getStandardName()
public Property.Type getType()
public void setType(Property.Type aType)
public void setTypeName(java.lang.String aName)
public void setTypeFromSample(java.lang.String aSample)
public boolean isPrimary()
public void setPrimary(boolean isPrimary)
public boolean isPrivate()
public void setPrivate(boolean isPrivate)
public Property.StringSize getStringSize()
public void setStringSize(Property.StringSize aSize)
public Property.StringSize getStringSizeDefault()
public Property.NumberType getNumberType()
public void setNumberType(Property.NumberType aNumberType)
public Property.NumberType getNumberTypeDefault()
public Property.DateType getDateType()
public void setDateType(Property.DateType aDateType)
public Property.DateType getDateTypeDefault()
public boolean isAutoGenerated()
public void setAutoGenerated(boolean aValue)
public boolean isNullable()
public void setNullable(boolean aValue)
public boolean getNullableDefault()
public java.lang.Object getDefaultValue()
public void setDefaultValue(java.lang.Object aValue)
public java.util.List<java.lang.String> getEnumStrings()
public void setEnumStrings(java.util.List<java.lang.String> theValues)
public java.lang.String getEnumsString()
public void setEnumsString(java.lang.String aValue)
public boolean isAttribute()
public boolean isRelation()
public boolean isToMany()
public boolean isDerived()
public void setToMany(boolean aValue)
public Entity getRelationEntity()
public void setRelationEntity(Entity anEntity)
public java.lang.String getRelationEntityName()
public void setRelationEntityName(java.lang.String aName)
public java.lang.String getRelationLocalPropertyName()
public void setRelationLocalPropertyName(java.lang.String aName)
public java.lang.String getRelationRemotePropertyName()
public void setRelationRemotePropertyName(java.lang.String aName)
public Property getRelationLocalProperty()
public Property getRelationRemoteProperty()
public java.lang.Object convertValue(java.lang.Object anObj)
public java.lang.Object getKeyValue(java.lang.String aKey)
public java.lang.String toString(java.lang.Object aValue)
public boolean equals(java.lang.Object anObj)
equals
in class java.lang.Object
public Property clone()
clone
in class RMListenerList
public int compareTo(java.lang.Object anObj)
compareTo
in interface java.lang.Comparable
public RXElement toXML(RXArchiver anArchiver)
toXML
in interface Archivable
public Property fromXML(RXArchiver anArchiver, RXElement anElement)
fromXML
in interface Archivable
public java.util.List<java.lang.String> getJSONKeys()
getJSONKeys
in interface RMJSONArchiver.GetKeys