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 DefaultClassGenerator

    java.lang.Object
      org.apache.cayenne.gen.MapClassGenerator
          org.apache.cayenne.gen.DefaultClassGenerator

Direct Known Subclasses:
  AntClassGenerator

Deprecated. since 3.0 use `ClassGenerationAction` and subclasses.

    public class DefaultClassGenerator

extends MapClassGenerator

Extends MapClassGenerator to allow target-specific filesystem locations where the files should go. Adds "execute" method that performs class generation based on the internal state of this object.

Author:
  Andrus Adamchik

Field Summary
`protected File` | `destDir` Deprecated.
`protected String` | `encoding` Deprecated. Stores the encoding of the generated file.
`protected boolean` | `makePairs` Deprecated.
`protected String` | `outputPattern` Deprecated.
`protected boolean` | `overwrite` Deprecated.
`protected String` | `superTemplate` Deprecated.
`protected String` | `template` Deprecated.
`protected long` | `timestamp` Deprecated.
`protected boolean` | `usePkgPath` Deprecated.

Fields inherited from class org.apache.cayenne.gen.MapClassGenerator
`client, CLIENT_SUBCLASS_TEMPLATE_1_2, CLIENT_SUPERCLASS_TEMPLATE_1_2, dataMap, DEFAULT_VERSION, mode, MODE_DATAMAP, MODE_ENTITY, objEntities, SINGLE_CLASS_TEMPLATE, SINGLE_CLASS_TEMPLATE_1_1, SINGLE_CLASS_TEMPLATE_1_2, SUBCLASS_TEMPLATE, SUBCLASS_TEMPLATE_1_1, SUBCLASS_TEMPLATE_1_2, SUPERCLASS_PREFIX, SUPERCLASS_TEMPLATE, SUPERCLASS_TEMPLATE_1_1, SUPERCLASS_TEMPLATE_1_2, superPkg, VERSION_1_1, VERSION_1_2, versionString, vppConfig`

Constructor Summary
`DefaultClassGenerator()` Deprecated.
`DefaultClassGenerator(DataMap dataMap)` Deprecated. Creates class generator and initializes it with DataMap.
`DefaultClassGenerator(DataMap dataMap, List<ObjEntity> selectedObjEntities)` Deprecated. Creates class generator and initializes it with the list of ObjEntities that will be used in class generation.

Method Summary
`void` | `closeWriter(Writer out)` Deprecated. Closes writer after class code has been successfully written by ClassGenerationInfo.
`void` | `execute()` Deprecated. Runs class generation.
`protected File` | `fileForClass(String pkgName, String className)` Deprecated. Returns a target file where a generated class must be saved.
`protected File` | `fileForSuperclass(String pkgName, String className)` Deprecated. Returns a target file where a generated superclass must be saved.
`String` | `getEncoding()` Deprecated. Returns file encoding for the generated files.
`protected String` | `getSupertemplateForPairs()` Deprecated. Returns template file path for Java superclass when generating class pairs.
`protected String` | `getTemplateForPairs()` Deprecated. Returns template file path for Java subclass when generating class pairs.
`protected String` | `getTemplateForSingles()` Deprecated. Returns template file path for Java class when generating single classes.
`long` | `getTimestamp()` Deprecated. Returns internal timestamp of this generator used to make decisions about overwriting individual files.
`protected boolean` | `isOld(File file)` Deprecated. Returns true if `file` parameter is older than internal timestamp of this class generator.
`protected File` | `mkpath(File dest, String pkgName)` Deprecated. Returns a File object corresponding to a directory where files that belong to `pkgName` package should reside.
`Writer` | `openWriter(ObjEntity entity, String pkgName, String className)` Deprecated. Opens a Writer to write generated output.
`void` | `setDestDir(File destDir)` Deprecated. Sets the destDir.
`void` | `setEncoding(String encoding)` Deprecated. Sets file encoding.
`void` | `setMakePairs(boolean makePairs)` Deprecated. Sets `makepairs` property.
`void` | `setOutputPattern(String outputPattern)` Deprecated. Sets `outputPattern` property.
`void` | `setOverwrite(boolean overwrite)` Deprecated. Sets `overwrite` property.
`void` | `setSuperTemplate(String superTemplate)` Deprecated. Sets `superTemplate` property.
`void` | `setTemplate(String template)` Deprecated. Sets `template` property.
`void` | `setTimestamp(long timestamp)` Deprecated.
`void` | `setUsePkgPath(boolean usePkgPath)` Deprecated. Sets `usepkgpath` property.
`void` | `validateAttributes()` Deprecated. Validates the state of this class generator.

Methods inherited from class org.apache.cayenne.gen.MapClassGenerator
`defaultSingleClassTemplate, defaultSubclassTemplate, defaultSuperclassTemplate, generateClassPairs, generateClassPairs, generateSingleClasses, generateSingleClasses, getDataMap, getObjEntities, getSuperPkg, getVersionString, getVppConfig, initClassGenerator_1_1, isClient, setClient, setDataMap, setMode, setObjEntities, setSuperPkg, setVersionString, setVppConfig`

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

Field Detail

### destDir

    protected File destDir

  Deprecated.

### overwrite

    protected boolean overwrite

  Deprecated.

### usePkgPath

    protected boolean usePkgPath

  Deprecated.

### makePairs

    protected boolean makePairs

  Deprecated.

### template

    protected String template

  Deprecated.

### superTemplate

    protected String superTemplate

  Deprecated.

### timestamp

    protected long timestamp

  Deprecated.

### outputPattern

    protected String outputPattern

  Deprecated.

### encoding

    protected String encoding

  Deprecated.
  Stores the encoding of the generated file.

  Since:
    1.2

Constructor Detail

### DefaultClassGenerator

    public DefaultClassGenerator()

  Deprecated.

### DefaultClassGenerator

    public DefaultClassGenerator(DataMap dataMap)

  Deprecated.
  Creates class generator and initializes it with DataMap. This will ensure generation of classes for all ObjEntities in the DataMap.

### DefaultClassGenerator

    public DefaultClassGenerator(DataMap dataMap,
                                 List<ObjEntity> selectedObjEntities)

  Deprecated.
  Creates class generator and initializes it with the list of ObjEntities that will be used in class generation.

Method Detail

### execute

    public void execute()
                 throws Exception

  Deprecated.
  Runs class generation.

  Throws:
    `Exception`

### validateAttributes

    public void validateAttributes()
                            throws Exception

  Deprecated.
  Validates the state of this class generator. Throws exception if it is in inconsistent state. Called internally from "execute".

  Throws:
    `Exception`

### setDestDir

    public void setDestDir(File destDir)

  Deprecated.
  Sets the destDir.

### setOverwrite

    public void setOverwrite(boolean overwrite)

  Deprecated.
  Sets `overwrite` property.

### setMakePairs

    public void setMakePairs(boolean makePairs)

  Deprecated.
  Sets `makepairs` property.

### setTemplate

    public void setTemplate(String template)

  Deprecated.
  Sets `template` property.

### setSuperTemplate

    public void setSuperTemplate(String superTemplate)

  Deprecated.
  Sets `superTemplate` property.

### setUsePkgPath

    public void setUsePkgPath(boolean usePkgPath)

  Deprecated.
  Sets `usepkgpath` property.

### setOutputPattern

    public void setOutputPattern(String outputPattern)

  Deprecated.
  Sets `outputPattern` property.

### closeWriter

    public void closeWriter(Writer out)
                     throws Exception

  Deprecated.
  Description copied from class: `MapClassGenerator`
  Closes writer after class code has been successfully written by ClassGenerationInfo.

  Specified by:
    `closeWriter` in class `MapClassGenerator`
  Throws:
    `Exception`

### openWriter

    public Writer openWriter(ObjEntity entity,
                             String pkgName,
                             String className)
                      throws Exception

  Deprecated.
  Opens a Writer to write generated output. Writer encoding is determined from the value of the "encoding" property.

  Specified by:
    `openWriter` in class `MapClassGenerator`
  Returns:
    Writer to store generated class source code or null if this class generation should be skipped.
  Throws:
    `Exception`

### fileForSuperclass

    protected File fileForSuperclass(String pkgName,
                                     String className)
                              throws Exception

  Deprecated.
  Returns a target file where a generated superclass must be saved. If null is returned, class shouldn't be generated.

  Throws:
    `Exception`

### fileForClass

    protected File fileForClass(String pkgName,
                                String className)
                         throws Exception

  Deprecated.
  Returns a target file where a generated class must be saved. If null is returned, class shouldn't be generated.

  Throws:
    `Exception`

### isOld

    protected boolean isOld(File file)

  Deprecated.
  Returns true if `file` parameter is older than internal timestamp of this class generator.

### mkpath

    protected File mkpath(File dest,
                          String pkgName)
                   throws Exception

  Deprecated.
  Returns a File object corresponding to a directory where files that belong to `pkgName` package should reside. Creates any missing diectories below `dest`.

  Throws:
    `Exception`

### getTemplateForSingles

    protected String getTemplateForSingles()
                                    throws IOException

  Deprecated.
  Returns template file path for Java class when generating single classes.

  Throws:
    `IOException`

### getTemplateForPairs

    protected String getTemplateForPairs()
                                  throws IOException

  Deprecated.
  Returns template file path for Java subclass when generating class pairs.

  Throws:
    `IOException`

### getSupertemplateForPairs

    protected String getSupertemplateForPairs()
                                       throws IOException

  Deprecated.
  Returns template file path for Java superclass when generating class pairs.

  Throws:
    `IOException`

### getTimestamp

    public long getTimestamp()

  Deprecated.
  Returns internal timestamp of this generator used to make decisions about overwriting individual files.

### setTimestamp

    public void setTimestamp(long timestamp)

  Deprecated.

### getEncoding

    public String getEncoding()

  Deprecated.
  Returns file encoding for the generated files.

  Since:
    1.2

### setEncoding

    public void setEncoding(String encoding)

  Deprecated.
  Sets file encoding. If set to null, default system encoding will be used.

  Since:
    1.2

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-2008 Apache Cayenne. All Rights Reserved.