org.apache.cayenne.gen
Class ClassGenerationInfo

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

public class ClassGenerationInfo
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".

Since:
1.2
Author:
Andrei Adamchik

Field Summary
protected  java.lang.String className
           
protected  ObjEntity entity
           
protected  java.lang.String packageName
           
protected  java.lang.String prop
           
protected  java.lang.String superClassName
           
protected  java.lang.String superPackageName
           
protected  java.lang.String superPrefix
           
 
Constructor Summary
ClassGenerationInfo()
           
 
Method Summary
 java.lang.String capitalized(java.lang.String name)
          Capitalizes the first letter of the property name.
 java.lang.String capitalizedAsConstant(java.lang.String name)
          Converts property name to Java constants naming convention.
 java.lang.String formatJavaType(java.lang.String type)
           
 java.lang.String formatVariableName(java.lang.String variableName)
           
 java.lang.String getCappedProp()
          Returns current property name with capitalized first letter
 java.lang.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.
 java.lang.String getPackageName()
          Returns Java package name of the class associated with this generator.
 java.lang.String getProp()
           
 java.lang.String getPropAsConstantName()
           
 java.lang.String getSuperClassName()
          Returns the fully qualified super class of the data object class associated with this generator
 java.lang.String getSuperPackageName()
          Returns superPackageName property that defines a superclass's package name.
 java.lang.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(java.lang.String className)
          Sets class name of the class associated with this generator.
protected  void setObjEntity(ObjEntity entity)
           
protected  void setPackageName(java.lang.String packageName)
          Sets Java package name of the class associated with this generator.
 void setProp(java.lang.String prop)
          Sets current class property name.
protected  void setSuperClassName(java.lang.String value)
          Sets the fully qualified super class of the data object class associated with this generator
protected  void setSuperPackageName(java.lang.String superPackageName)
          Sets superPackageName property that defines a superclass's package name.
protected  void setSuperPrefix(java.lang.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 java.lang.String packageName

className

protected java.lang.String className

superPrefix

protected java.lang.String superPrefix

prop

protected java.lang.String prop

superPackageName

protected java.lang.String superPackageName

superClassName

protected java.lang.String superClassName
Constructor Detail

ClassGenerationInfo

public ClassGenerationInfo()
Method Detail

getPackageName

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


setPackageName

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


getSuperPackageName

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


setSuperPackageName

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


getClassName

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


setClassName

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


setSuperPrefix

protected void setSuperPrefix(java.lang.String superPrefix)

formatJavaType

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

formatVariableName

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

getSuperPrefix

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


setProp

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


getProp

public java.lang.String getProp()

capitalized

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

Since:
1.1

capitalizedAsConstant

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

Since:
1.1

getCappedProp

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


getPropAsConstantName

public java.lang.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 java.lang.String getSuperClassName()
Returns the fully qualified super class of the data object class associated with this generator


setSuperClassName

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



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