001: // $Id: StandardProperty.java 10119 2006-07-14 00:09:19Z steve.ebersole@jboss.com $
002: package org.hibernate.tuple;
003:
004: import org.hibernate.engine.CascadeStyle;
005: import org.hibernate.type.Type;
006: import org.hibernate.FetchMode;
007:
008: /**
009: * Represents a basic property within the Hibernate runtime-metamodel.
010: *
011: * @author Steve Ebersole
012: */
013: public class StandardProperty extends Property {
014:
015: private final boolean lazy;
016: private final boolean insertable;
017: private final boolean updateable;
018: private final boolean insertGenerated;
019: private final boolean updateGenerated;
020: private final boolean nullable;
021: private final boolean dirtyCheckable;
022: private final boolean versionable;
023: private final CascadeStyle cascadeStyle;
024: private final FetchMode fetchMode;
025:
026: /**
027: * Constructs StandardProperty instances.
028: *
029: * @param name The name by which the property can be referenced within
030: * its owner.
031: * @param node The node name to use for XML-based representation of this
032: * property.
033: * @param type The Hibernate Type of this property.
034: * @param lazy Should this property be handled lazily?
035: * @param insertable Is this property an insertable value?
036: * @param updateable Is this property an updateable value?
037: * @param insertGenerated Is this property generated in the database on insert?
038: * @param updateGenerated Is this property generated in the database on update?
039: * @param nullable Is this property a nullable value?
040: * @param checkable Is this property a checkable value?
041: * @param versionable Is this property a versionable value?
042: * @param cascadeStyle The cascade style for this property's value.
043: * @param fetchMode Any fetch mode defined for this property
044: */
045: public StandardProperty(String name, String node, Type type,
046: boolean lazy, boolean insertable, boolean updateable,
047: boolean insertGenerated, boolean updateGenerated,
048: boolean nullable, boolean checkable, boolean versionable,
049: CascadeStyle cascadeStyle, FetchMode fetchMode) {
050: super (name, node, type);
051: this .lazy = lazy;
052: this .insertable = insertable;
053: this .updateable = updateable;
054: this .insertGenerated = insertGenerated;
055: this .updateGenerated = updateGenerated;
056: this .nullable = nullable;
057: this .dirtyCheckable = checkable;
058: this .versionable = versionable;
059: this .cascadeStyle = cascadeStyle;
060: this .fetchMode = fetchMode;
061: }
062:
063: public boolean isLazy() {
064: return lazy;
065: }
066:
067: public boolean isInsertable() {
068: return insertable;
069: }
070:
071: public boolean isUpdateable() {
072: return updateable;
073: }
074:
075: public boolean isInsertGenerated() {
076: return insertGenerated;
077: }
078:
079: public boolean isUpdateGenerated() {
080: return updateGenerated;
081: }
082:
083: public boolean isNullable() {
084: return nullable;
085: }
086:
087: public boolean isDirtyCheckable(boolean hasUninitializedProperties) {
088: return isDirtyCheckable()
089: && (!hasUninitializedProperties || !isLazy());
090: }
091:
092: public boolean isDirtyCheckable() {
093: return dirtyCheckable;
094: }
095:
096: public boolean isVersionable() {
097: return versionable;
098: }
099:
100: public CascadeStyle getCascadeStyle() {
101: return cascadeStyle;
102: }
103:
104: public FetchMode getFetchMode() {
105: return fetchMode;
106: }
107: }
|