Class Cfg2JavaTool

java.lang.Object
org.hibernate.tool.internal.export.java.Cfg2JavaTool

public class Cfg2JavaTool extends Object
Helper methods for javacode generation.

Author:
max
  • Constructor Details

    • Cfg2JavaTool

      public Cfg2JavaTool()
  • Method Details

    • getPOJOClass

      public POJOClass getPOJOClass(org.hibernate.mapping.Component comp)
    • getPOJOClass

      public POJOClass getPOJOClass(org.hibernate.mapping.PersistentClass comp)
    • unqualify

      public String unqualify(String name)
    • getMetaAsString

      public String getMetaAsString(org.hibernate.mapping.MetaAttributable pc, String attribute)
      Returns all meta items as one large string.
    • hasMetaAttribute

      public boolean hasMetaAttribute(org.hibernate.mapping.MetaAttributable pc, String attribute)
    • getMetaAsString

      public String getMetaAsString(org.hibernate.mapping.MetaAttributable pc, String attribute, String seperator)
    • getMetaAsBool

      public boolean getMetaAsBool(org.hibernate.mapping.MetaAttributable ma, String attribute)
    • getMetaAsBool

      public boolean getMetaAsBool(org.hibernate.mapping.MetaAttributable pc, String attribute, boolean defaultValue)
    • toJavaDoc

      public String toJavaDoc(String string, int indent)
      Convert string into something that can be rendered nicely into a javadoc comment. Prefix each line with a star ('*').
      Parameters:
      string -
    • getClassModifiers

      public String getClassModifiers(org.hibernate.mapping.MetaAttributable pc)
    • getJavaTypeName

      public String getJavaTypeName(org.hibernate.mapping.Property p, boolean useGenerics)
      Returns the typename for a property, using generics if this is a Set type and useGenerics is set to true.
    • getJavaTypeName

      public String getJavaTypeName(org.hibernate.mapping.Property p, boolean useGenerics, ImportContext importContext)
    • isNonPrimitiveTypeName

      public static boolean isNonPrimitiveTypeName(String typeName)
    • getGenericCollectionDeclaration

      public String getGenericCollectionDeclaration(org.hibernate.mapping.Collection collection, boolean preferRawTypeNames, ImportContext importContext)
    • getFilteredIdentifierGeneratorProperties

      public Properties getFilteredIdentifierGeneratorProperties(org.hibernate.mapping.SimpleValue simpleValue)
      Parameters:
      simpleValue -
      Returns:
    • asParameterList

      public String asParameterList(Iterator<?> fields, boolean useGenerics, ImportContext ic)
    • asArgumentList

      public String asArgumentList(Iterator<?> fields)
      Parameters:
      fields - iterator on Property elements.
      Returns:
      "name, number, ..." for a property list, usable for method calls.

      TODO: handle this in a template ?

    • asNaturalIdParameterList

      public String asNaturalIdParameterList(org.hibernate.mapping.PersistentClass clazz)
      Parameters:
      clazz - persistent class.
      Returns:
      "String name, int number, ..." for a property list, usable for method declarations.

      TODO: handle this in a template ?

    • asParameterList

      public String asParameterList(List<org.hibernate.mapping.Property> fields, boolean useGenerics, ImportContext ic)
    • asArgumentList

      public String asArgumentList(List<org.hibernate.mapping.Property> fields)
    • asFinderArgumentList

      public String asFinderArgumentList(Map<Object,Object> parameterTypes, ImportContext ctx)
    • isPrimitive

      public boolean isPrimitive(String typeName)
    • isComponent

      public boolean isComponent(org.hibernate.mapping.Property property)
    • isComponent

      public boolean isComponent(org.hibernate.mapping.Value value)
    • getPOJOIterator

      public Iterator<POJOClass> getPOJOIterator(Iterator<org.hibernate.mapping.PersistentClass> persistentClasses)
    • simplePluralize

      public String simplePluralize(String str)
    • keyWordCheck

      public String keyWordCheck(String possibleKeyword)
    • isArray

      public boolean isArray(String typeName)
    • getParameterTypes

      public Map<?,?> getParameterTypes(org.hibernate.boot.query.NamedHqlQueryDefinition<?> query)