Overview | Package | Class | Use | 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 ImportUtils

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

    public class ImportUtils

extends Object

Methods for mangling strings.

Author:
  Mike Kienenberger

Field Summary
`static String[]` | `importOrdering`
`protected Map` | `importTypesMap`
`protected String` | `packageName`
`protected Map` | `reservedImportTypesMap`

Constructor Summary
`ImportUtils()`

Method Summary
`void` | `addReservedType(String typeName)` Reserve a fully-qualified data type class name so it cannot be used by another class.
`void` | `addType(String typeName)` Register a fully-qualified data type class name.
`protected boolean` | `canRegisterType(String typeName)`
`String` | `formatJavaType(String typeName)` Removes registered package and non-reserved registered type name prefixes from java types
`String` | `formatJavaType(String typeName, boolean usePrimitives)` Performs processing similar to `formatJavaType(String)`, with special handling of primitive types and their Java class counterparts.
`String` | `generate()` Generate package and list of import statements based on the registered types.
`void` | `setPackage(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 String[] importOrdering

### importTypesMap

    protected Map importTypesMap

### reservedImportTypesMap

    protected Map reservedImportTypesMap

### packageName

    protected String packageName

Constructor Detail

### ImportUtils

    public ImportUtils()

Method Detail

### canRegisterType

    protected boolean canRegisterType(String typeName)

### addReservedType

    public void addReservedType(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(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(String packageName)

  Add the package name to use for this importUtil invocation.

  Parameters:
    `packageName` -

### formatJavaType

    public String formatJavaType(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 String formatJavaType(String typeName)

  Removes registered package and non-reserved registered type name prefixes from java types

### generate

    public String generate()

  Generate package and list of import statements based on the registered types.

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

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