Class BasicPOJOClass
java.lang.Object
org.hibernate.tool.internal.export.java.BasicPOJOClass
- All Implemented Interfaces:
ImportContext,MetaAttributeConstants,POJOClass
- Direct Known Subclasses:
ComponentPOJOClass,EntityPOJOClass
Abstract implementation of POJOClass. To be extended by ComponentPOJO and EntityPOJO
- Author:
- max, Amit Bhayani
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Cfg2JavaToolprotected ImportContextprotected org.hibernate.mapping.MetaAttributableFields inherited from interface org.hibernate.tool.internal.export.java.MetaAttributeConstants
CLASS_DESCRIPTION, CLASS_MODIFIER, EXTENDS, GEN_PROPERTY, GENERATED_CLASS, IMPLEMENTS, INTERFACE, SCOPE_CLASS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidappendCommonColumnInfo(StringBuffer annotations, org.hibernate.mapping.Column column, boolean insertable, boolean updatable) static StringbeanCapitalize(String fieldname) foo -> Foo FOo -> FOogenerateAnnColumnAnnotation(org.hibernate.mapping.Property property) generateBasicAnnotation(org.hibernate.mapping.Property property) generateEquals(String thisName, String otherName, boolean useGenerics) protected StringgenerateEquals(String thisName, String otherName, Iterator<org.hibernate.mapping.Property> allPropertiesIterator, boolean useGenerics) generateHashCode(org.hibernate.mapping.Property property, String result, String thisName, boolean jdk5) abstract Iterator<org.hibernate.mapping.Property> returns the properties that would be visible on this entity as a pojo.getClassJavaDoc(String fallback, int indent) Returns the javadoc associated with the class.getCollectionNameFor(org.hibernate.mapping.Property property) Iterator<org.hibernate.mapping.Property> abstract StringgetFieldDescription(org.hibernate.mapping.Property property) getFieldInitialization(org.hibernate.mapping.Property p, boolean useGenerics) getFieldJavaDoc(org.hibernate.mapping.Property property, int indent) getFieldModifiers(org.hibernate.mapping.Property property) protected StringgetGetterSignature(org.hibernate.mapping.Property p) Method getGetterSignature.abstract StringgetJavaTypeName(org.hibernate.mapping.Property p, boolean useGenerics) protected abstract StringbooleangetMetaAsBool(String attribute) booleangetMetaAsBool(String attribute, boolean defaultValue) getMetaAsString(String attribute) getMetaAsString(String attribute, String seperator) booleangetMetaAttribAsBool(org.hibernate.mapping.MetaAttributable pc, String attribute, boolean defaultValue) Returns "package packagename;" where packagename is either the declared packagename, or the one provide via meta attribute "generated-class".protected StringgetPackageDeclaration(String pkgName) Return package name.getPropertyGetModifiers(org.hibernate.mapping.Property property) getPropertyName(org.hibernate.mapping.Property p) getPropertySetModifiers(org.hibernate.mapping.Property property) Iterator<org.hibernate.mapping.Property> booleanhasFieldInitializor(org.hibernate.mapping.Property p, boolean useGenerics) booleanhasFieldJavaDoc(org.hibernate.mapping.Property property) booleanhasMetaAttribute(String attribute) booleanhasMetaAttribute(org.hibernate.mapping.MetaAttributable pc, String attribute) importType(String fqcn) Add fqcn to the import list.protected voidinit()booleanisComponent(org.hibernate.mapping.Property property) booleanprotected booleanisRequiredInConstructor(org.hibernate.mapping.Property field) booleanbooleanbooleanbooleanprotected StringqualifyInnerClass(String className) staticImport(String fqcn, String member) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.hibernate.tool.internal.export.java.POJOClass
generateAnnIdGenerator, generateAnnTableUniqueConstraint, getDecoratedObject, getIdentifierProperty, getPropertiesForFullConstructor, getPropertiesForMinimalConstructor, getPropertyClosureForFullConstructor, getPropertyClosureForMinimalConstructor, getPropertyClosureForSuperclassFullConstructor, getPropertyClosureForSuperclassMinimalConstructor, getSuperClass, getVersionProperty, hasIdentifierProperty, hasVersionProperty, isComponent, isSubclass
-
Field Details
-
importContext
-
meta
protected org.hibernate.mapping.MetaAttributable meta -
c2j
-
-
Constructor Details
-
BasicPOJOClass
-
-
Method Details
-
init
protected void init() -
getPackageDeclaration
-
getPackageDeclaration
Description copied from interface:POJOClassReturns "package packagename;" where packagename is either the declared packagename, or the one provide via meta attribute "generated-class". Returns "// default package" if no package declarition available.- Specified by:
getPackageDeclarationin interfacePOJOClass
-
getPackageName
Return package name. Note: Does not handle inner classes- Specified by:
getPackageNamein interfacePOJOClass
-
getShortName
- Specified by:
getShortNamein interfacePOJOClass
-
getQualifiedDeclarationName
- Specified by:
getQualifiedDeclarationNamein interfacePOJOClass
-
getDeclarationName
- Specified by:
getDeclarationNamein interfacePOJOClass- Returns:
- unqualified classname for this class (can be changed by meta attribute "generated-class")
-
getGeneratedClassName
-
qualifyInnerClass
-
getMappedClassName
-
getMetaAsString
-
hasMetaAttribute
-
getMetaAsString
-
getMetaAsBool
-
getMetaAsBool
-
getClassJavaDoc
Description copied from interface:POJOClassReturns the javadoc associated with the class.- Specified by:
getClassJavaDocin interfacePOJOClass- Parameters:
fallback- the default text if nothing else is foundindent- how many spaces should be added- Returns:
-
getClassModifiers
- Specified by:
getClassModifiersin interfacePOJOClass
-
getDeclarationType
- Specified by:
getDeclarationTypein interfacePOJOClass- Returns:
- declaration type "interface" or "class"
-
isInterface
public boolean isInterface()- Specified by:
isInterfacein interfacePOJOClass
-
getExtendsDeclaration
- Specified by:
getExtendsDeclarationin interfacePOJOClass
-
getImplementsDeclaration
- Specified by:
getImplementsDeclarationin interfacePOJOClass
-
generateEquals
- Specified by:
generateEqualsin interfacePOJOClass
-
getAllPropertiesIterator
returns the properties that would be visible on this entity as a pojo. This does not return *all* properties since hibernate has certain properties that are only relevant in context of persistence.- Specified by:
getAllPropertiesIteratorin interfacePOJOClass
-
generateEquals
-
getExtraClassCode
- Specified by:
getExtraClassCodein interfacePOJOClass
-
needsEqualsHashCode
public boolean needsEqualsHashCode()- Specified by:
needsEqualsHashCodein interfacePOJOClass
-
getExtends
- Specified by:
getExtendsin interfacePOJOClass
-
getImplements
- Specified by:
getImplementsin interfacePOJOClass
-
importType
Description copied from interface:ImportContextAdd fqcn to the import list. Returns fqcn as needed in source code. Attempts to handle fqcn with array and generics references. e.g. java.util.Collectioninvalid input: '<'org.marvel.Hulk> imports java.util.Collection and returns Collection org.marvel.Hulk[] imports org.marvel.Hulk and returns Hulk- Specified by:
importTypein interfaceImportContext- Parameters:
fqcn-- Returns:
- import string
-
generateImports
- Specified by:
generateImportsin interfaceImportContext
-
staticImport
- Specified by:
staticImportin interfaceImportContext
-
generateBasicAnnotation
- Specified by:
generateBasicAnnotationin interfacePOJOClass
-
generateAnnColumnAnnotation
- Specified by:
generateAnnColumnAnnotationin interfacePOJOClass
-
appendCommonColumnInfo
protected void appendCommonColumnInfo(StringBuffer annotations, org.hibernate.mapping.Column column, boolean insertable, boolean updatable) -
getToStringPropertiesIterator
- Specified by:
getToStringPropertiesIteratorin interfacePOJOClass
-
getEqualsHashCodePropertiesIterator
- Specified by:
getEqualsHashCodePropertiesIteratorin interfacePOJOClass
-
needsToString
public boolean needsToString()- Specified by:
needsToStringin interfacePOJOClass
-
hasMetaAttribute
-
getMetaAttribAsBool
public boolean getMetaAttribAsBool(org.hibernate.mapping.MetaAttributable pc, String attribute, boolean defaultValue) -
hasFieldJavaDoc
public boolean hasFieldJavaDoc(org.hibernate.mapping.Property property) -
getFieldJavaDoc
- Specified by:
getFieldJavaDocin interfacePOJOClass
-
getFieldDescription
- Specified by:
getFieldDescriptionin interfacePOJOClass
-
getGetterSignature
Method getGetterSignature.- Returns:
- String
-
getPropertyName
- Parameters:
p-- Returns:
- foo -> Foo, FOo -> FOo
-
getCollectionNameFor
-
beanCapitalize
foo -> Foo FOo -> FOo -
isComponent
public boolean isComponent(org.hibernate.mapping.Property property) -
generateHashCode
-
getFieldModifiers
-
getPropertyGetModifiers
-
getPropertySetModifiers
-
isRequiredInConstructor
protected boolean isRequiredInConstructor(org.hibernate.mapping.Property field) -
needsMinimalConstructor
public boolean needsMinimalConstructor()- Specified by:
needsMinimalConstructorin interfacePOJOClass
-
needsFullConstructor
public boolean needsFullConstructor()- Specified by:
needsFullConstructorin interfacePOJOClass
-
getJavaTypeName
- Specified by:
getJavaTypeNamein interfacePOJOClass
-
hasFieldInitializor
public boolean hasFieldInitializor(org.hibernate.mapping.Property p, boolean useGenerics) -
getFieldInitialization
- Specified by:
getFieldInitializationin interfacePOJOClass
-