Package org.castor.cpa.jpa.natures
Class JPAFieldNature
java.lang.Object
org.castor.core.nature.BaseNature
org.castor.cpa.jpa.natures.JPAFieldNature
- All Implemented Interfaces:
Nature
A
BaseNature extension, that gives access to information derived from
field bound JPA annotations.- Since:
- 1.3
- Author:
- Peter Schmidt, Martin Kandler
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionJPAFieldNature(PropertyHolder holder) Instantiate aJPAFieldNatureto access the givenPropertyHolder. -
Method Summary
Modifier and TypeMethodDescriptionfinal javax.persistence.FetchTypejavax.persistence.CascadeType[]final StringReturns the 'columnDefinition' value of the @Column annotation.final Booleanfinal Integerfinal StringReturns the name of the @Column annotation.final Booleanfinal Integerfinal Integerfinal Stringfinal Booleanfinal BooleanGet the underlyingFieldInfo(thePropertyHolder).Get theGeneratedValue.generator()javax.persistence.GenerationTypeGet theGeneratedValue.strategy()final StringgetId()Returns the fully qualified name of the Nature.final Stringfinal Booleanfinal Stringfinal Booleanfinal Stringfinal Stringfinal Booleanfinal Booleanjavax.persistence.JoinColumn[]javax.persistence.JoinColumn[]Class<?> Class<?> javax.persistence.TemporalTypefinal booleanfinal booleanisId()booleanisLob()booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanfinal booleanfinal voidsetBasicFetch(javax.persistence.FetchType fetch) final voidsetBasicOptional(boolean optional) voidsetCascadeTypes(javax.persistence.CascadeType[] cascadeTypes) final voidsetColumnDefinition(String columnDefinition) Sets the 'columnDefinition' value of the @Column annotation.final voidsetColumnInsertable(boolean insertable) final voidsetColumnLength(int length) final voidsetColumnName(String name) Set the name value of the @Column annotation.final voidsetColumnNullable(boolean nullable) final voidsetColumnPrecision(int precision) final voidsetColumnScale(int scale) final voidsetColumnTable(String table) final voidsetColumnUnique(boolean unique) final voidsetColumnUpdatable(boolean updatable) voidsetGeneratedValueGenerator(String generator) Set theGeneratedValue.generator()voidsetGeneratedValueStrategy(javax.persistence.GenerationType strategy) Set theGeneratedValue.strategy()final voidsetId(boolean isId) final voidsetJoinColumnColumnDefinition(String columnDefinition) final voidsetJoinColumnInsertable(boolean insertable) final voidsetJoinColumnName(String name) final voidsetJoinColumnNullable(boolean nullable) final voidsetJoinColumnReferencedColumnName(String referencedColumnName) final voidsetJoinColumnTable(String table) final voidsetJoinColumnUnique(boolean unique) final voidsetJoinColumnUpdatable(boolean updatable) voidsetJoinTableCatalog(String catalog) voidsetJoinTableInverseJoinColumns(javax.persistence.JoinColumn[] inverseJoinColumns) voidsetJoinTableJoinColumns(javax.persistence.JoinColumn[] joinColumns) voidsetJoinTableName(String tablename) voidsetJoinTableSchema(String schema) voidsetLob(boolean isLob) voidsetManyToMany(boolean hasManyToMany) voidsetManyToManyInverseCopy(boolean copySettingsInverse) voidsetManyToOne(boolean hasManyToOne) voidsetOneToMany(boolean hasOneToMany) voidsetOneToOne(boolean hasOneToOne) voidsetRelationCollectionType(Class<?> collectionType) voidsetRelationLazyFetch(boolean lazyFetch) voidsetRelationMappedBy(String mappedBy) voidsetRelationOptional(boolean optional) voidsetRelationTargetEntity(Class<?> targetEntity) voidsetStringEnumType(boolean isStringEnumType) voidsetTemporalType(javax.persistence.TemporalType temporalType) final voidsetTransient(boolean isTransient) Methods inherited from class org.castor.core.nature.BaseNature
getBooleanPropertyDefaultFalse, getHolder, getProperty, getPropertyAsList, getPropertyAsMap, setProperty
-
Field Details
-
TEMPORAL_TYPE
Property Key forTemporal- See Also:
-
LOB
Property Key forLob- See Also:
-
STRING_ENUM_TYPE
Property Key forEnumerated- See Also:
-
CASCADE_TYPES
Property Key forCascadeTypearray of a relation.- See Also:
-
-
Constructor Details
-
JPAFieldNature
Instantiate aJPAFieldNatureto access the givenPropertyHolder.- Parameters:
holder- The underlyingPropertyHolder(obviously aFieldInfo).- See Also:
-
-
Method Details
-
getId
Returns the fully qualified name of the Nature.- Returns:
- qualified name of the nature.
- See Also:
-
getFieldInfo
Get the underlyingFieldInfo(thePropertyHolder).- Returns:
- the underlying
FieldInfo. If thePropertyHolderwas not of typeFieldInfo, null is returned.
-
setBasicFetch
public final void setBasicFetch(javax.persistence.FetchType fetch) - Parameters:
fetch- The value ofBasic.fetch()- See Also:
-
getBasicFetch
public final javax.persistence.FetchType getBasicFetch()- Returns:
- The value of
Basic.fetch() - See Also:
-
setBasicOptional
public final void setBasicOptional(boolean optional) - Parameters:
optional- The value ofBasic.optional()- See Also:
-
isBasicOptional
public final boolean isBasicOptional()- Returns:
- True if
Basic.optional()was set to true on the field. - See Also:
-
setColumnName
Set the name value of the @Column annotation.- Parameters:
name- The value ofColumn.name()- See Also:
-
getColumnName
Returns the name of the @Column annotation.- Returns:
- The value of
Column.name() - See Also:
-
setColumnDefinition
Sets the 'columnDefinition' value of the @Column annotation.- Parameters:
columnDefinition- The value ofColumn.columnDefinition()- See Also:
-
getColumnDefinition
Returns the 'columnDefinition' value of the @Column annotation.- Returns:
- The value of
Column.columnDefinition() - See Also:
-
setColumnLength
public final void setColumnLength(int length) - Parameters:
length- The value ofColumn.length()- See Also:
-
getColumnLength
- Returns:
- The value of
Column.length() - See Also:
-
setColumnInsertable
public final void setColumnInsertable(boolean insertable) - Parameters:
insertable- The value ofColumn.insertable()- See Also:
-
getColumnInsertable
- Returns:
- The value of
Column.insertable() - See Also:
-
setColumnNullable
public final void setColumnNullable(boolean nullable) - Parameters:
nullable- The value ofColumn.nullable()- See Also:
-
getColumnNullable
- Returns:
- The value of
Column.nullable() - See Also:
-
setColumnPrecision
public final void setColumnPrecision(int precision) - Parameters:
precision- The value ofColumn.precision()- See Also:
-
getColumnPrecision
- Returns:
- The value of
Column.precision() - See Also:
-
setColumnScale
public final void setColumnScale(int scale) - Parameters:
scale- The value ofColumn.scale()- See Also:
-
getColumnScale
- Returns:
- The value of
Column.scale() - See Also:
-
setColumnTable
- Parameters:
table- The value ofColumn.table()- See Also:
-
getColumnTable
- Returns:
- The value of
Column.table() - See Also:
-
setColumnUnique
public final void setColumnUnique(boolean unique) - Parameters:
unique- The value ofColumn.unique()- See Also:
-
getColumnUnique
- Returns:
- The value of
Column.unique() - See Also:
-
setColumnUpdatable
public final void setColumnUpdatable(boolean updatable) - Parameters:
updatable- The value ofColumn.updatable()- See Also:
-
getColumnUpdatable
- Returns:
- The value of
Column.updatable() - See Also:
-
setId
public final void setId(boolean isId) - Parameters:
isId- IfIdwas found on that property.- See Also:
-
isId
public final boolean isId()- Returns:
- true if
Idwas set on the property, else false. - See Also:
-
setTransient
public final void setTransient(boolean isTransient) - Parameters:
isTransient- ifTransientwas found on that property.- See Also:
-
isTransient
public final boolean isTransient()- Returns:
- true if
Transientwas set on the property, else false - See Also:
-
setJoinTableName
- Parameters:
tablename- The value ofJoinTable.name()- See Also:
-
getJoinTableName
- Returns:
- The value of
JoinTable.name() - See Also:
-
setJoinTableCatalog
- Parameters:
catalog- The value ofJoinTable.catalog()- See Also:
-
getJoinTableCatalog
- Returns:
- The value of
JoinTable.catalog() - See Also:
-
setJoinTableSchema
- Parameters:
schema- The value ofJoinTable.schema()- See Also:
-
getJoinTableSchema
- Returns:
- The value of
JoinTable.schema() - See Also:
-
setJoinTableJoinColumns
public void setJoinTableJoinColumns(javax.persistence.JoinColumn[] joinColumns) - Parameters:
joinColumns- The value ofJoinTable.joinColumns()- See Also:
-
getJoinTableJoinColumns
public javax.persistence.JoinColumn[] getJoinTableJoinColumns()- Returns:
- The value of
JoinTable.joinColumns() - See Also:
-
setJoinTableInverseJoinColumns
public void setJoinTableInverseJoinColumns(javax.persistence.JoinColumn[] inverseJoinColumns) - Parameters:
inverseJoinColumns- The value ofJoinTable.inverseJoinColumns()- See Also:
-
getJoinTableInverseJoinColumns
public javax.persistence.JoinColumn[] getJoinTableInverseJoinColumns()- Returns:
- The value of
JoinTable.inverseJoinColumns() - See Also:
-
setJoinColumnName
- Parameters:
name- The value ofJoinColumn.name().- See Also:
-
getJoinColumnName
- Returns:
- The value of
JoinColumn.name(). - See Also:
-
setJoinColumnReferencedColumnName
- Parameters:
referencedColumnName- The value ofJoinColumn.referencedColumnName().- See Also:
-
getJoinColumnReferencedColumnName
- Returns:
- The value of
JoinColumn.referencedColumnName(). - See Also:
-
setJoinColumnUnique
public final void setJoinColumnUnique(boolean unique) - Parameters:
unique- The value ofJoinColumn.unique().- See Also:
-
getJoinColumnUnique
- Returns:
- The value of
JoinColumn.unique(). - See Also:
-
setJoinColumnNullable
public final void setJoinColumnNullable(boolean nullable) - Parameters:
nullable- The value ofJoinColumn.nullable().- See Also:
-
getJoinColumnNullable
- Returns:
- The value of
JoinColumn.nullable(). - See Also:
-
setJoinColumnInsertable
public final void setJoinColumnInsertable(boolean insertable) - Parameters:
insertable- The value ofJoinColumn.insertable().- See Also:
-
getJoinColumnInsertable
- Returns:
- The value of
JoinColumn.insertable(). - See Also:
-
setJoinColumnUpdatable
public final void setJoinColumnUpdatable(boolean updatable) - Parameters:
updatable- The value ofJoinColumn.updatable().- See Also:
-
getJoinColumnUpdatable
- Returns:
- The value of
JoinColumn.updatable(). - See Also:
-
setJoinColumnColumnDefinition
- Parameters:
columnDefinition- The value ofJoinColumn.columnDefinition().- See Also:
-
getJoinColumnColumnDefinition
- Returns:
- The value of
JoinColumn.columnDefinition(). - See Also:
-
setJoinColumnTable
- Parameters:
table- The value ofJoinColumn.table().- See Also:
-
getJoinColumnTable
- Returns:
- The value of
JoinColumn.table(). - See Also:
-
setOneToOne
public void setOneToOne(boolean hasOneToOne) - Parameters:
hasOneToOne- ifOneToOnewas found on that property.- See Also:
-
isOneToOne
public boolean isOneToOne()- Returns:
- if
OneToOnewas set on the property, else false. - See Also:
-
setManyToOne
public void setManyToOne(boolean hasManyToOne) - Parameters:
hasManyToOne- ifManyToOnewas found on that property.- See Also:
-
isManyToOne
public boolean isManyToOne()- Returns:
- if
ManyToOnewas set on the property, else false. - See Also:
-
setOneToMany
public void setOneToMany(boolean hasOneToMany) - Parameters:
hasOneToMany- ifOneToManywas found on that property.- See Also:
-
isOneToMany
public boolean isOneToMany()- Returns:
- if
OneToManywas set on the property, else false. - See Also:
-
setManyToMany
public void setManyToMany(boolean hasManyToMany) - Parameters:
hasManyToMany- ifManyToManywas found on that property.- See Also:
-
isManyToMany
public boolean isManyToMany()- Returns:
- if
ManyToOnewas set on the property, else false. - See Also:
-
setManyToManyInverseCopy
public void setManyToManyInverseCopy(boolean copySettingsInverse) - Parameters:
copySettingsInverse- set this to true if a ManyToMany related field shall copy allrelevant information from the other side of the relation (inverting theinvalid reference
JoinTableJoinColumnsettings).- See Also:
-
isManyToManyInverseCopy
public boolean isManyToManyInverseCopy()- Returns:
- if this is true a ManyToMany related field shall copy all
relevant information from the other side of the relation (inverting the
invalid reference
JoinTableJoinColumnsettings). - See Also:
-
setRelationTargetEntity
- Parameters:
targetEntity- The value ofOneToOne.targetEntity(),OneToMany.targetEntity(),ManyToOne.targetEntity(),ManyToMany.targetEntity(), depending to the relation type.- See Also:
-
getRelationTargetEntity
- Returns:
- The value of
OneToOne.targetEntity(),OneToMany.targetEntity(),ManyToOne.targetEntity(),ManyToMany.targetEntity(), depending on the relation type. Returns null iff no relational annotation was set on the field. - See Also:
-
setRelationLazyFetch
public void setRelationLazyFetch(boolean lazyFetch) - Parameters:
lazyFetch- true ifOneToOne.fetch(),OneToMany.fetch(),ManyToOne.fetch(),ManyToMany.fetch()is set toFetchType.LAZY, depending on the relation type.- See Also:
-
isRelationLazyFetch
public boolean isRelationLazyFetch()- Returns:
- true if
OneToOne.fetch(),OneToMany.fetch(),ManyToOne.fetch(),ManyToMany.fetch()is set toFetchType.LAZY, depending on the relation type. - See Also:
-
setRelationMappedBy
- Parameters:
mappedBy- The content ofOneToMany.mappedBy(),ManyToMany.mappedBy(), depending on the relation type.- See Also:
-
getRelationMappedBy
- Returns:
- The content of
OneToMany.mappedBy(),ManyToMany.mappedBy(), depending on the relation type. If no (or an empty) String was set, null is returned! - See Also:
-
getRelationCollectionType
- Returns:
- The type of Collection being used by
OneToMany,ManyToMany, depending on the relation type. Returns null iff none of the above relational annotations was set on the field. - See Also:
-
setRelationCollectionType
- Parameters:
collectionType- Set the type of Collection being used byOneToMany,ManyToMany, depending on the relation type.- See Also:
-
setRelationOptional
public void setRelationOptional(boolean optional) - Parameters:
optional- Set the value ofOneToOne.optional(),ManyToOne.optional(), depending on the relation type.- See Also:
-
isRelationOptional
public boolean isRelationOptional()- Returns:
- true if
OneToOne.optional(),ManyToOne.optional()was set to true, depending on the relation type. - See Also:
-
setGeneratedValueStrategy
public void setGeneratedValueStrategy(javax.persistence.GenerationType strategy) Set theGeneratedValue.strategy()- Parameters:
strategy-- See Also:
-
getGeneratedValueStrategy
public javax.persistence.GenerationType getGeneratedValueStrategy()Get theGeneratedValue.strategy()- Returns:
- strategy
- See Also:
-
setGeneratedValueGenerator
Set theGeneratedValue.generator()- Parameters:
strategy-- See Also:
-
getGeneratedValueGenerator
Get theGeneratedValue.generator()- Returns:
- strategy
- See Also:
-
getTemporalType
public javax.persistence.TemporalType getTemporalType()- Returns:
- The
TemporalTypeof field. - See Also:
-
setTemporalType
public void setTemporalType(javax.persistence.TemporalType temporalType) - Parameters:
temporalType- set theTemporalTypeof field.- See Also:
-
isLob
public boolean isLob()- Returns:
- true if
Lobwas set on the property, else false - See Also:
-
setLob
public void setLob(boolean isLob) - Parameters:
isLob- ifLobwas found on that property.- See Also:
-
isStringEnumType
public boolean isStringEnumType()- Returns:
- true if
Enumeratedwith valueEnumTypeSTRING was set on the property, else false - See Also:
-
setStringEnumType
public void setStringEnumType(boolean isStringEnumType) - Parameters:
isStringEnumType- ifEnumeratedwith valueEnumTypeSTRING was found on that property.- See Also:
-
getCascadeTypes
public javax.persistence.CascadeType[] getCascadeTypes()- Returns:
- The
CascadeTypearray of relation. - See Also:
-
setCascadeTypes
public void setCascadeTypes(javax.persistence.CascadeType[] cascadeTypes) - Parameters:
cascadeTypes- set theCascadeTypearray of relation.- See Also:
-