Package org.apache.cayenne.map
Class ObjAttribute
java.lang.Object
org.apache.cayenne.map.Attribute
org.apache.cayenne.map.ObjAttribute
- All Implemented Interfaces:
Serializable,ConfigurationNode,CayenneMapEntry,XMLSerializable
- Direct Known Subclasses:
EmbeddedAttribute
An ObjAttribute is a mapping descriptor of a Java class property.
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionObjAttribute(String name) ObjAttribute(String name, String type, ObjEntity entity) ObjAttribute(ObjAttribute attribute) Creates a clone of an ObjAttribute argument. -
Method Summary
Modifier and TypeMethodDescription<T> TacceptVisitor(ConfigurationNodeVisitor<T> visitor) voidencodeAsXML(XMLEncoder encoder, ConfigurationNodeVisitor delegate) Prints itself as XML to the provided XMLEncoder.Returns an ObjAttribute stripped of any server-side information, such as DbAttribute mapping.Returns a DbAttribute mapped by this ObjAttribute.Returns the the name of the mapped DbAttribute.Returns a dot-separated path that starts in the root DbEntity that maps to this attribute's ObjEntity and spans zero or more relationships, always ending in a DbAttribute name.getDbPathIterator(ObjEntity entity) Returns parent entity that holds this attribute.Class<?> Returns Java class of an object property described by this attribute.intReturns this attribute's maximum allowed lengthgetType()Returns fully qualified Java class name of the object property represented by this attribute.booleanReturns whether this attribute is "flattened", meaning that it points to a column from an entity other than the DbEntity mapped to the parent ObjEntity.booleanReturnstrueif attribute inherited from a super entity.booleanisLazy()booleanReturns whether this attribute is mandatorybooleanbooleanReturns whether this attribute should be used for locking.voidsetDbAttributePath(String dbAttributePath) voidsetLazy(boolean lazy) Sets whether this attribute should be loaded lazily.voidSets the type of the data object property.voidsetUsedForLocking(boolean usedForLocking) Sets whether this attribute should be used for locking.toString()voidUpdates DbAttributePath for this ObjAttribute
-
Field Details
-
type
-
usedForLocking
protected boolean usedForLocking -
lazy
protected boolean lazy- Since:
- 4.2
-
dbAttributePath
-
-
Constructor Details
-
ObjAttribute
public ObjAttribute() -
ObjAttribute
-
ObjAttribute
-
ObjAttribute
Creates a clone of an ObjAttribute argument.- Since:
- 3.0
-
-
Method Details
-
getEntity
Description copied from class:AttributeReturns parent entity that holds this attribute. -
acceptVisitor
- Specified by:
acceptVisitorin interfaceConfigurationNode- Since:
- 3.1
-
getJavaClass
Returns Java class of an object property described by this attribute. Wraps any thrown exceptions into CayenneRuntimeException. -
encodeAsXML
Prints itself as XML to the provided XMLEncoder.- Specified by:
encodeAsXMLin interfaceXMLSerializable- Specified by:
encodeAsXMLin classAttribute- Since:
- 1.1
-
getType
Returns fully qualified Java class name of the object property represented by this attribute. -
setType
Sets the type of the data object property. Type is expected to be a fully qualified Java class name. -
isPrimaryKey
public boolean isPrimaryKey()- Since:
- 3.0
-
isUsedForLocking
public boolean isUsedForLocking()Returns whether this attribute should be used for locking.- Since:
- 1.1
-
setUsedForLocking
public void setUsedForLocking(boolean usedForLocking) Sets whether this attribute should be used for locking.- Since:
- 1.1
-
isLazy
public boolean isLazy()- Returns:
- whether this attribute should be loaded lazily.
- Since:
- 4.2
-
setLazy
public void setLazy(boolean lazy) Sets whether this attribute should be loaded lazily.- Since:
- 4.2
-
getDbAttribute
Returns a DbAttribute mapped by this ObjAttribute. -
isInherited
public boolean isInherited()Returnstrueif attribute inherited from a super entity.- Since:
- 3.0
-
getDbPathIterator
-
getDbPathIterator
-
getDbAttributeName
Returns the the name of the mapped DbAttribute. This value is the same as "dbAttributePath" for regular attributes mapped to columns. It is equql to the last path component for the flattened attributes. -
setDbAttributePath
-
getDbAttributePath
Returns a dot-separated path that starts in the root DbEntity that maps to this attribute's ObjEntity and spans zero or more relationships, always ending in a DbAttribute name. -
isFlattened
public boolean isFlattened()Returns whether this attribute is "flattened", meaning that it points to a column from an entity other than the DbEntity mapped to the parent ObjEntity.- Since:
- 3.0
-
isMandatory
public boolean isMandatory()Returns whether this attribute is mandatory- See Also:
-
getMaxLength
public int getMaxLength()Returns this attribute's maximum allowed length- See Also:
-
getClientAttribute
Returns an ObjAttribute stripped of any server-side information, such as DbAttribute mapping.- Since:
- 1.2
-
updateDbAttributePath
public void updateDbAttributePath()Updates DbAttributePath for this ObjAttribute -
toString
-