Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.cayenne.gen
Class ClassGenerator

    java.lang.Object
      org.apache.cayenne.gen.ClassGenerator

    public class ClassGenerator

extends java.lang.Object

Class generation engine for ObjEntities based on Velocity templates . Instance of ClassGenerationInfo is available inside Velocity template under the key "classGen".

Author:
  Andrei Adamchik

Field Summary
`protected ClassGenerationInfo` | `classGenerationInfo`
`protected org.apache.velocity.Template` | `classTemplate`
`protected org.apache.velocity.context.Context` | `velCtxt`
`static java.lang.String` | `VERSION_1_1`
`static java.lang.String` | `VERSION_1_2`
`protected java.lang.String` | `versionString`

Constructor Summary
`ClassGenerator(java.lang.String template)` Deprecated. Since 1.2 use ClassGenerator(String template, String versionString) instead.
`ClassGenerator(java.lang.String template, java.lang.String versionString)` Creates a new ClassGenerationInfo that uses a specified Velocity template.
`ClassGenerator(java.lang.String template, java.lang.String versionString, foundrylogic.vpp.VPPConfig vppConfig)` Creates a new ClassGenerationInfo that uses a specified Velocity template.

Method Summary
`static void` | `bootstrapVelocity(java.lang.Class cl)` Deprecated. since 1.2, as now Cayenne uses thread ClassLoader.
`java.lang.String` | `capitalized(java.lang.String name)` Deprecated. Since 1.2 use getClassGenerationInfo().capitalized(String)
`java.lang.String` | `capitalizedAsConstant(java.lang.String name)` Deprecated. Since 1.2 use getClassGenerationInfo().capitalizedAsConstant(String)
`java.lang.String` | `formatJavaType(java.lang.String type)` Deprecated. use getClassGenerationInfo().formatJavaType(String)
`java.lang.String` | `formatVariableName(java.lang.String variableName)` Deprecated. Since 1.2 use getClassGenerationInfo().formatVariableName(String)
`void` | `generateClass(java.io.Writer out, DataMap dataMap, ObjEntity entity, java.lang.String fqnBaseClass, java.lang.String fqnSuperClass, java.lang.String fqnSubClass)` Generates Java code for the ObjEntity.
`void` | `generateClass(java.io.Writer out, ObjEntity entity)` Generates Java code for the ObjEntity.
`java.lang.String` | `getCappedProp()` Deprecated. Since 1.2 use getClassGenerationInfo().getCappedProp()
`ClassGenerationInfo` | `getClassGenerationInfo()`
`java.lang.String` | `getClassName()` Deprecated. Since 1.2 use getClassGenerationInfo().getClassName()
`ObjEntity` | `getEntity()` Deprecated. Since 1.2 use getClassGenerationInfo().getEntity()
`java.lang.String` | `getPackageName()` Deprecated. Since 1.2 use getClassGenerationInfo().getPackageName()
`java.lang.String` | `getProp()` Deprecated. Since 1.2 use getClassGenerationInfo().getProp()
`java.lang.String` | `getPropAsConstantName()` Deprecated. Since 1.2 use getClassGenerationInfo().getPropAsConstantName()
`java.lang.String` | `getSuperClassName()` Deprecated. Since 1.2 use getClassGenerationInfo().getSuperClassName()
`java.lang.String` | `getSuperPackageName()` Deprecated. Since 1.2 use getClassGenerationInfo().getSuperPackageName()
`java.lang.String` | `getSuperPrefix()` Deprecated. Since 1.2 use getClassGenerationInfo().getSuperPrefix()
`boolean` | `isContainingListProperties()` Deprecated. Since 1.2 use getClassGenerationInfo().isContainingListProperties()
`boolean` | `isUsingPackage()` Deprecated. Since 1.2 use getClassGenerationInfo().isUsingPackage()
`boolean` | `isUsingSuperPackage()` Deprecated. Since 1.2 use getClassGenerationInfo().isUsingSuperPackage()
`void` | `setClassName(java.lang.String className)` Deprecated. Since 1.2 use getClassGenerationInfo().setClassName()
`void` | `setPackageName(java.lang.String packageName)` Deprecated. Since 1.2 use getClassGenerationInfo().setPackageName()
`void` | `setProp(java.lang.String prop)` Deprecated. Since 1.2 use getClassGenerationInfo().setProp(String)
`void` | `setSuperClassName(java.lang.String value)` Deprecated. Since 1.2 use getClassGenerationInfo().setSuperClassName()
`void` | `setSuperPackageName(java.lang.String superPackageName)` Deprecated. Since 1.2 use getClassGenerationInfo().setSuperPackageName()
`void` | `setSuperPrefix(java.lang.String superPrefix)` Deprecated. Since 1.2 use getClassGenerationInfo().setSuperPrefix()

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### VERSION_1_1

    public static final java.lang.String VERSION_1_1

See Also:
  Constant Field Values

### VERSION_1_2

    public static final java.lang.String VERSION_1_2

See Also:
  Constant Field Values

### versionString

    protected java.lang.String versionString

### classTemplate

    protected org.apache.velocity.Template classTemplate

### velCtxt

    protected org.apache.velocity.context.Context velCtxt

### classGenerationInfo

    protected ClassGenerationInfo classGenerationInfo

Constructor Detail

### ClassGenerator

    public ClassGenerator(java.lang.String template)
                   throws java.lang.Exception

  Deprecated. Since 1.2 use ClassGenerator(String template, String versionString) instead.

  Creates a new ClassGenerationInfo that uses a specified Velocity template.

  Throws:
    `java.lang.Exception`

### ClassGenerator

    public ClassGenerator(java.lang.String template,
                          java.lang.String versionString)
                   throws java.lang.Exception

  Creates a new ClassGenerationInfo that uses a specified Velocity template.

  Parameters:
    `template` - to use
    `versionString` - of cgen
  Throws:
    `java.lang.Exception`
  Since:
    1.2

### ClassGenerator

    public ClassGenerator(java.lang.String template,
                          java.lang.String versionString,
                          foundrylogic.vpp.VPPConfig vppConfig)
                   throws java.lang.Exception

  Creates a new ClassGenerationInfo that uses a specified Velocity template.

  Parameters:
    `template` - to use
    `versionString` - of cgen
    `vppConfig` - for configuring VelocityEngine and VelocityContext
  Throws:
    `java.lang.Exception`
  Since:
    1.2

Method Detail

### bootstrapVelocity

    public static final void bootstrapVelocity(java.lang.Class cl)

  Deprecated. since 1.2, as now Cayenne uses thread ClassLoader.

### generateClass

    public void generateClass(java.io.Writer out,
                              ObjEntity entity)
                       throws java.lang.Exception

  Generates Java code for the ObjEntity. Output is written to the provided Writer.

  Throws:
    `java.lang.Exception`

### generateClass

    public void generateClass(java.io.Writer out,
                              DataMap dataMap,
                              ObjEntity entity,
                              java.lang.String fqnBaseClass,
                              java.lang.String fqnSuperClass,
                              java.lang.String fqnSubClass)
                       throws java.lang.Exception

  Generates Java code for the ObjEntity. Output is written to the provided Writer.

  Throws:
    `java.lang.Exception`

### getClassGenerationInfo

    public ClassGenerationInfo getClassGenerationInfo()

  Returns:
    Returns the classGenerationInfo in template.

### getPackageName

    public java.lang.String getPackageName()

  Deprecated. Since 1.2 use getClassGenerationInfo().getPackageName()

  Returns Java package name of the class associated with this generator.

### setPackageName

    public void setPackageName(java.lang.String packageName)

  Deprecated. Since 1.2 use getClassGenerationInfo().setPackageName()

  Sets Java package name of the class associated with this generator.

### setSuperPackageName

    public void setSuperPackageName(java.lang.String superPackageName)

  Deprecated. Since 1.2 use getClassGenerationInfo().setSuperPackageName()

  Sets `superPackageName` property that defines a superclass's package name.

### getClassName

    public java.lang.String getClassName()

  Deprecated. Since 1.2 use getClassGenerationInfo().getClassName()

  Returns class name (without a package) of the class associated with this generator.

### setClassName

    public void setClassName(java.lang.String className)

  Deprecated. Since 1.2 use getClassGenerationInfo().setClassName()

  Sets class name of the class associated with this generator. Class name must not include a package.

### setSuperClassName

    public void setSuperClassName(java.lang.String value)

  Deprecated. Since 1.2 use getClassGenerationInfo().setSuperClassName()

  Sets the fully qualified super class of the data object class associated with this generator

### setSuperPrefix

    public void setSuperPrefix(java.lang.String superPrefix)

  Deprecated. Since 1.2 use getClassGenerationInfo().setSuperPrefix()

  Returns prefix used to distinguish between superclass and subclass when generating classes in pairs.

### getSuperPackageName

    public java.lang.String getSuperPackageName()

  Deprecated. Since 1.2 use getClassGenerationInfo().getSuperPackageName()

  Returns `superPackageName` property that defines a superclass's package name.

### formatJavaType

    public java.lang.String formatJavaType(java.lang.String type)

  Deprecated. use getClassGenerationInfo().formatJavaType(String)

### formatVariableName

    public java.lang.String formatVariableName(java.lang.String variableName)

  Deprecated. Since 1.2 use getClassGenerationInfo().formatVariableName(String)

### getSuperPrefix

    public java.lang.String getSuperPrefix()

  Deprecated. Since 1.2 use getClassGenerationInfo().getSuperPrefix()

  Returns prefix used to distinguish between superclass and subclass when generating classes in pairs.

### setProp

    public void setProp(java.lang.String prop)

  Deprecated. Since 1.2 use getClassGenerationInfo().setProp(String)

  Sets current class property name. This method is called during template parsing for each of the class properties.

### getProp

    public java.lang.String getProp()

  Deprecated. Since 1.2 use getClassGenerationInfo().getProp()

### capitalized

    public java.lang.String capitalized(java.lang.String name)

  Deprecated. Since 1.2 use getClassGenerationInfo().capitalized(String)

  Capitalizes the first letter of the property name.

  Since:
    1.1

### capitalizedAsConstant

    public java.lang.String capitalizedAsConstant(java.lang.String name)

  Deprecated. Since 1.2 use getClassGenerationInfo().capitalizedAsConstant(String)

  Converts property name to Java constants naming convention.

  Since:
    1.1

### getCappedProp

    public java.lang.String getCappedProp()

  Deprecated. Since 1.2 use getClassGenerationInfo().getCappedProp()

  Returns current property name with capitalized first letter

### getPropAsConstantName

    public java.lang.String getPropAsConstantName()

  Deprecated. Since 1.2 use getClassGenerationInfo().getPropAsConstantName()

  Returns:
    a current property name converted to a format used by java static final variables - all capitalized with underscores.
  Since:
    1.0.3

### isContainingListProperties

    public boolean isContainingListProperties()

  Deprecated. Since 1.2 use getClassGenerationInfo().isContainingListProperties()

  Returns true if current entity contains at least one List property.

  Since:
    1.1

### isUsingPackage

    public boolean isUsingPackage()

  Deprecated. Since 1.2 use getClassGenerationInfo().isUsingPackage()

  Returns `true` if a class associated with this generator is located in a package.

### isUsingSuperPackage

    public boolean isUsingSuperPackage()

  Deprecated. Since 1.2 use getClassGenerationInfo().isUsingSuperPackage()

  Returns `true` if a superclass class associated with this generator is located in a package.

### getEntity

    public ObjEntity getEntity()

  Deprecated. Since 1.2 use getClassGenerationInfo().getEntity()

  Returns entity for the class associated with this generator.

### getSuperClassName

    public java.lang.String getSuperClassName()

  Deprecated. Since 1.2 use getClassGenerationInfo().getSuperClassName()

  Returns the fully qualified super class of the data object class associated with this generator

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2001-2006 Apache.org All Rights Reserved.