ma.glasnost.orika.impl.generator
Class CompilerStrategy

java.lang.Object
  extended by ma.glasnost.orika.impl.generator.CompilerStrategy
Direct Known Subclasses:
EclipseJdtCompilerStrategy, JavassistCompilerStrategy

public abstract class CompilerStrategy
extends Object

Defines a standard compiler profile for use in generating mapping objects.

Author:
matt.deboer@gmail.com

Nested Class Summary
static class CompilerStrategy.SourceCodeGenerationException
           
 
Field Summary
protected  String pathToWriteClassFiles
           
protected  String pathToWriteSourceFiles
           
protected static String WRITE_RELATIVE_TO_CLASSPATH
           
protected  boolean writeClassFiles
           
protected  boolean writeSourceFiles
           
 
Constructor Summary
protected CompilerStrategy(String writeSourceByDefault, String writeClassByDefault)
           
 
Method Summary
abstract  void assureTypeIsAccessible(Class<?> type)
          Verify that the Class provided is accessible to the compiler/generator.
abstract  Class<?> compileClass(SourceCodeContext sourceCode)
          Compile and return the (generated) class; this will also cause the generated class to be detached from the class-pool, and any (optional) source and/or class files to be written.
protected  File preparePackageOutputPath(String basePath, String packageName)
          Prepares the output path for a given package based on the provided base path string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

writeSourceFiles

protected final boolean writeSourceFiles

writeClassFiles

protected final boolean writeClassFiles

pathToWriteSourceFiles

protected final String pathToWriteSourceFiles

pathToWriteClassFiles

protected final String pathToWriteClassFiles

WRITE_RELATIVE_TO_CLASSPATH

protected static final String WRITE_RELATIVE_TO_CLASSPATH
See Also:
Constant Field Values
Constructor Detail

CompilerStrategy

protected CompilerStrategy(String writeSourceByDefault,
                           String writeClassByDefault)
Method Detail

compileClass

public abstract Class<?> compileClass(SourceCodeContext sourceCode)
                               throws CompilerStrategy.SourceCodeGenerationException
Compile and return the (generated) class; this will also cause the generated class to be detached from the class-pool, and any (optional) source and/or class files to be written.

Returns:
the (generated) compiled class
Throws:
CompilerStrategy.SourceCodeGenerationException

assureTypeIsAccessible

public abstract void assureTypeIsAccessible(Class<?> type)
                                     throws CompilerStrategy.SourceCodeGenerationException
Verify that the Class provided is accessible to the compiler/generator.

Parameters:
type -
Throws:
CompilerStrategy.SourceCodeGenerationException - if the type is not accessible

preparePackageOutputPath

protected File preparePackageOutputPath(String basePath,
                                        String packageName)
                                 throws IOException
Prepares the output path for a given package based on the provided base path string. If the base path string begins with "classpath:", then the path is resolved relative to this class' classpath root; otherwise, it is treated as an absolute file name.

Parameters:
basePath -
packageName -
Returns:
Throws:
IOException


Copyright © 2013 Glasnost. All Rights Reserved.