org.apache.cayenne.gen
Class ImportUtils

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

public class ImportUtils
extends java.lang.Object

Methods for mangling strings.

Author:
Mike Kienenberger

Field Summary
static java.lang.String[] importOrdering
           
protected  java.util.Map importTypesMap
           
protected  java.lang.String packageName
           
protected  java.util.Map reservedImportTypesMap
           
 
Constructor Summary
ImportUtils()
           
 
Method Summary
 void addReservedType(java.lang.String typeName)
          Reserve a fully-qualified data type class name so it cannot be used by another class.
 void addType(java.lang.String typeName)
          Register a fully-qualified data type class name.
protected  boolean canRegisterType(java.lang.String typeName)
           
 java.lang.String formatJavaType(java.lang.String typeName)
          Removes registered package and non-reserved registered type name prefixes from java types
 java.lang.String formatJavaType(java.lang.String typeName, boolean usePrimitives)
          Performs processing similar to formatJavaType(String), with special handling of primitive types and their Java class counterparts.
 java.lang.String generate()
          Generate package and list of import statements based on the registered types.
 void setPackage(java.lang.String packageName)
          Add the package name to use for this importUtil invocation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

importOrdering

public static final java.lang.String[] importOrdering

importTypesMap

protected java.util.Map importTypesMap

reservedImportTypesMap

protected java.util.Map reservedImportTypesMap

packageName

protected java.lang.String packageName
Constructor Detail

ImportUtils

public ImportUtils()
Method Detail

canRegisterType

protected boolean canRegisterType(java.lang.String typeName)

addReservedType

public void addReservedType(java.lang.String typeName)
Reserve a fully-qualified data type class name so it cannot be used by another class. No import statements will be generated for reserved types. Typically, this is the fully-qualified class name of the class being generated.

Parameters:
typeName - FQ data type class name.

addType

public void addType(java.lang.String typeName)
Register a fully-qualified data type class name. For example, org.apache.cayenne.CayenneDataObject

Parameters:
typeName - FQ data type class name.

setPackage

public void setPackage(java.lang.String packageName)
Add the package name to use for this importUtil invocation.

Parameters:
packageName -

formatJavaType

public java.lang.String formatJavaType(java.lang.String typeName,
                                       boolean usePrimitives)
Performs processing similar to formatJavaType(String), with special handling of primitive types and their Java class counterparts. This method allows users to make a decision whether to use primitives or not, regardless of how type is mapped.


formatJavaType

public java.lang.String formatJavaType(java.lang.String typeName)
Removes registered package and non-reserved registered type name prefixes from java types


generate

public java.lang.String generate()
Generate package and list of import statements based on the registered types.



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