public class ApplicationIdTool extends Object
Modifier and Type | Class and Description |
---|---|
static class |
ApplicationIdTool.Flags
Run flags.
|
static interface |
ApplicationIdTool.ObjectIdLoader
Interface implemented by metadata factories that can load non-existant
object id classes.
|
Modifier and Type | Field and Description |
---|---|
static String |
TOKEN_DEFAULT |
Constructor and Description |
---|
ApplicationIdTool(OpenJPAConfiguration conf,
Class type)
Constructs a new ApplicationIdTool capable of generating an
object id class for
type . |
ApplicationIdTool(OpenJPAConfiguration conf,
Class type,
ClassMetaData meta)
Constructs a new tool instance capable of generating an
object id class for
meta . |
Modifier and Type | Method and Description |
---|---|
String |
getCode()
Return the code generated for the application id, or null
if invalid class or the
run() method has not been called. |
CodeFormat |
getCodeFormat()
The code formatter for the generated Java code.
|
File |
getDirectory()
The directory to write source to.
|
boolean |
getIgnoreErrors()
Return false if this tool is configured to throw an exception on
an attempt to generate an id class for a type that does not use
application identity.
|
Set |
getImportPackages()
Returns the collection of packages that need to be imported.
|
ClassMetaData |
getMetaData()
Return metadata for the type we are generating an application id for.
|
String |
getToken()
The token to use to separate stringified primary key field values.
|
Class |
getType()
Return the type we are generating an application id for.
|
Writer |
getWriter()
The writer to write source to, or null to write to default file.
|
boolean |
isInnerClass()
Returns true if the application identity class should be an inner class.
|
static void |
main(String[] args)
Usage: java org.apache.openjpa.enhance.ApplicationIdTool [option]*
<class name | .java file | .class file | .jdo file>+
Where the following options are recognized.
|
void |
record()
Writes the generated code to the proper file.
|
boolean |
run()
Generates the sourcecode for the application id class; returns
false if the class is invalid.
|
static boolean |
run(OpenJPAConfiguration conf,
String[] args,
ApplicationIdTool.Flags flags,
ClassLoader loader)
Run the tool.
|
static boolean |
run(OpenJPAConfiguration conf,
String[] args,
Options opts)
Run the application id tool with the given command-line and
given configuration.
|
void |
setCodeFormat(CodeFormat format)
Set the code formatter for the generated Java code.
|
void |
setDirectory(File dir)
The directory to write source to.
|
void |
setIgnoreErrors(boolean ignore)
Set to false if this tool should throw an exception on
an attempt to generate an id class for a type that does not use
application identity.
|
void |
setToken(String token)
The token to use to separate stringified primary key field values.
|
void |
setWriter(Writer writer)
The writer to write source to, or null to write to default file.
|
public static final String TOKEN_DEFAULT
public ApplicationIdTool(OpenJPAConfiguration conf, Class type)
type
.public ApplicationIdTool(OpenJPAConfiguration conf, Class type, ClassMetaData meta)
meta
.public boolean getIgnoreErrors()
public void setIgnoreErrors(boolean ignore)
public CodeFormat getCodeFormat()
public void setCodeFormat(CodeFormat format)
public File getDirectory()
public void setDirectory(File dir)
public String getToken()
public void setToken(String token)
public Writer getWriter()
public void setWriter(Writer writer)
public Class getType()
public ClassMetaData getMetaData()
public String getCode()
run()
method has not been called.public boolean isInnerClass()
public boolean run()
public void record() throws IOException
IOException
public Set getImportPackages()
public static void main(String[] args) throws IOException, ClassNotFoundException
Configuration
; optional.OpenJPAConfiguration
can be
set by using their names and supplying a value.-name
or by any identity class name
specified in metadata.CodeFormat
.IOException
ClassNotFoundException
public static boolean run(OpenJPAConfiguration conf, String[] args, Options opts) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
public static boolean run(OpenJPAConfiguration conf, String[] args, ApplicationIdTool.Flags flags, ClassLoader loader) throws IOException, ClassNotFoundException
IOException
ClassNotFoundException
Copyright © 2006–2018 Apache Software Foundation. All rights reserved.