org.apache.cayenne.gen
Class ClassGenerationInfo

java.lang.Object
  extended by org.apache.cayenne.gen.ClassGenerationInfo

public class ClassGenerationInfo
extends Object

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

Since:
1.2
Author:
Andrus Adamchik

Field Summary
protected  String className
           
protected  ObjEntity entity
           
protected  String packageName
           
protected  String prop
           
protected  String superClassName
           
protected  String superPackageName
           
protected  String superPrefix
           
 
Constructor Summary
ClassGenerationInfo()
           
 
Method Summary
 String capitalized(String name)
          Capitalizes the first letter of the property name.
 String capitalizedAsConstant(String name)
          Converts property name to Java constants naming convention.
 String formatJavaType(String type)
           
 String formatVariableName(String variableName)
           
 String getCappedProp()
          Returns current property name with capitalized first letter
 String getClassName()
          Returns class name (without a package) of the class associated with this generator.
 ObjEntity getEntity()
          Returns entity for the class associated with this generator.
 String getPackageName()
          Returns Java package name of the class associated with this generator.
 String getProp()
           
 String getPropAsConstantName()
           
 String getSuperClassName()
          Returns the fully qualified super class of the data object class associated with this generator
 String getSuperPackageName()
          Returns superPackageName property that defines a superclass's package name.
 String getSuperPrefix()
          Returns prefix used to distinguish between superclass and subclass when generating classes in pairs.
 boolean isContainingDeclaredListProperties()
          Returns true if current entity contains at least one Declared List property.
 boolean isContainingListProperties()
          Returns true if current entity contains at least one List property.
 boolean isUsingPackage()
          Returns true if a class associated with this generator is located in a package.
 boolean isUsingSuperPackage()
          Returns true if a superclass class associated with this generator is located in a package.
protected  void setClassName(String className)
          Sets class name of the class associated with this generator.
protected  void setObjEntity(ObjEntity entity)
           
protected  void setPackageName(String packageName)
          Sets Java package name of the class associated with this generator.
 void setProp(String prop)
          Sets current class property name.
protected  void setSuperClassName(String value)
          Sets the fully qualified super class of the data object class associated with this generator
protected  void setSuperPackageName(String superPackageName)
          Sets superPackageName property that defines a superclass's package name.
protected  void setSuperPrefix(String superPrefix)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

entity

protected ObjEntity entity

packageName

protected String packageName

className

protected String className

superPrefix

protected String superPrefix

prop

protected String prop

superPackageName

protected String superPackageName

superClassName

protected String superClassName
Constructor Detail

ClassGenerationInfo

public ClassGenerationInfo()
Method Detail

getPackageName

public String getPackageName()
Returns Java package name of the class associated with this generator.


setPackageName

protected void setPackageName(String packageName)
Sets Java package name of the class associated with this generator.


getSuperPackageName

public String getSuperPackageName()
Returns superPackageName property that defines a superclass's package name.


setSuperPackageName

protected void setSuperPackageName(String superPackageName)
Sets superPackageName property that defines a superclass's package name.


getClassName

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


setClassName

protected void setClassName(String className)
Sets class name of the class associated with this generator. Class name must not include a package.


setSuperPrefix

protected void setSuperPrefix(String superPrefix)

formatJavaType

public String formatJavaType(String type)

formatVariableName

public String formatVariableName(String variableName)

getSuperPrefix

public String getSuperPrefix()
Returns prefix used to distinguish between superclass and subclass when generating classes in pairs.


setProp

public void setProp(String prop)
Sets current class property name. This method is called during template parsing for each of the class properties.


getProp

public String getProp()

capitalized

public String capitalized(String name)
Capitalizes the first letter of the property name.

Since:
1.1

capitalizedAsConstant

public String capitalizedAsConstant(String name)
Converts property name to Java constants naming convention.

Since:
1.1

getCappedProp

public String getCappedProp()
Returns current property name with capitalized first letter


getPropAsConstantName

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

isContainingDeclaredListProperties

public boolean isContainingDeclaredListProperties()
Returns true if current entity contains at least one Declared List property.

Since:
1.2

isContainingListProperties

public boolean isContainingListProperties()
Returns true if current entity contains at least one List property.

Since:
1.1

isUsingPackage

public boolean isUsingPackage()
Returns true if a class associated with this generator is located in a package.


isUsingSuperPackage

public boolean isUsingSuperPackage()
Returns true if a superclass class associated with this generator is located in a package.


getEntity

public ObjEntity getEntity()
Returns entity for the class associated with this generator.


setObjEntity

protected void setObjEntity(ObjEntity entity)
Parameters:
entity - The entity to set.

getSuperClassName

public String getSuperClassName()
Returns the fully qualified super class of the data object class associated with this generator


setSuperClassName

protected void setSuperClassName(String value)
Sets the fully qualified super class of the data object class associated with this generator



Copyright © 2001-2007 Apache Cayenne. All Rights Reserved.