|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

java.lang.Objectorg.jomc.tools.JomcTool
public abstract class JomcTool extends Object
Base tool class.
| Modifier and Type | Class and Description |
|---|---|
static class |
JomcTool.Listener
Listener interface. |
| Constructor and Description |
|---|
JomcTool()
Creates a new JomcTool instance. |
JomcTool(JomcTool tool)
Creates a new JomcTool instance taking a JomcTool instance to initialize the new instance with. |
| Modifier and Type | Method and Description |
|---|---|
static Level |
getDefaultLogLevel()
Gets the default log level events are logged at. |
static String |
getDefaultTemplateProfile()
Gets the default template profile. |
String |
getDisplayLanguage(String language)
Gets the display language of a given language code. |
String |
getIndentation()
Gets the indentation string of the instance. |
String |
getIndentation(int level)
Gets an indentation string for a given indentation level. |
String |
getInputEncoding()
Gets the encoding to use for reading files. |
String |
getJavaClasspathLocation(org.jomc.model.Implementation implementation)
Gets the Java class path location of an implementation. |
String |
getJavaClasspathLocation(org.jomc.model.Specification specification)
Gets the Java class path location of a specification. |
String |
getJavadocComment(org.jomc.model.Text text,
int indentationLevel,
String suffix)
Formats a text to a Javadoc comment. |
String |
getJavaGetterMethodName(org.jomc.model.Dependency dependency)
Gets the name of a Java accessor method of a given dependency. |
String |
getJavaGetterMethodName(org.jomc.model.Message message)
Gets the name of a Java accessor method of a given message. |
String |
getJavaGetterMethodName(org.jomc.model.Property property)
Gets the name of a Java accessor method of a given property. |
List<String> |
getJavaInterfaceNames(org.jomc.model.Implementation implementation,
boolean qualified)
Gets all Java interfaces an implementation implements. |
String |
getJavaModifierName(org.jomc.model.Implementation implementation,
org.jomc.model.Dependency dependency)
Gets the name of a Java modifier of a dependency of a given implementation. |
String |
getJavaModifierName(org.jomc.model.Implementation implementation,
org.jomc.model.Message message)
Gets the name of a Java modifier of a message of a given implementation. |
String |
getJavaModifierName(org.jomc.model.Implementation implementation,
org.jomc.model.Property property)
Gets the name of a Java modifier for a given property of a given implementation. |
String |
getJavaPackageName(org.jomc.model.Implementation implementation)
Gets the Java package name of an implementation. |
String |
getJavaPackageName(org.jomc.model.Specification specification)
Gets the Java package name of a specification. |
String |
getJavaPackageName(org.jomc.model.SpecificationReference reference)
Gets the Java package name of a specification reference. |
String |
getJavaString(String str)
Formats a string to a Java string with unicode escapes. |
String |
getJavaTypeName(org.jomc.model.Argument argument)
Gets the Java type name of an argument. |
String |
getJavaTypeName(org.jomc.model.Dependency dependency)
Gets the name of a Java type of a given dependency. |
String |
getJavaTypeName(org.jomc.model.Implementation implementation,
boolean qualified)
Gets the Java type name of an implementation. |
String |
getJavaTypeName(org.jomc.model.Property property,
boolean boxify)
Gets the Java type name of a property. |
String |
getJavaTypeName(org.jomc.model.Specification specification,
boolean qualified)
Gets the Java type name of a specification. |
String |
getJavaTypeName(org.jomc.model.SpecificationReference reference,
boolean qualified)
Gets the name of a Java type of a given specification reference. |
String |
getLineSeparator()
Gets the line separator of the instance. |
List<JomcTool.Listener> |
getListeners()
Gets the list of registered listeners. |
Level |
getLogLevel()
Gets the log level of the instance. |
String |
getLongDate(Calendar calendar)
Formats a calendar instance to a string. |
String |
getLongDateTime(Calendar calendar)
Formats a calendar instance to a string. |
String |
getLongTime(Calendar calendar)
Formats a calendar instance to a string. |
org.jomc.modlet.Model |
getModel()
Gets the model of the instance. |
org.jomc.model.Modules |
getModules()
Gets the modules of the instance. |
String |
getOutputEncoding()
Gets the encoding to use for writing files. |
String |
getShortDate(Calendar calendar)
Formats a calendar instance to a string. |
String |
getShortDateTime(Calendar calendar)
Formats a calendar instance to a string. |
String |
getShortTime(Calendar calendar)
Formats a calendar instance to a string. |
String |
getTemplateEncoding()
Gets the encoding to use for reading templates. |
String |
getTemplateProfile()
Gets the template profile of the instance. |
org.apache.velocity.VelocityContext |
getVelocityContext()
Gets the velocity context used for merging templates. |
org.apache.velocity.app.VelocityEngine |
getVelocityEngine()
Gets the VelocityEngine of the instance. |
org.apache.velocity.Template |
getVelocityTemplate(String templateName)
Gets a velocity template for a given name. |
String |
getYears(Calendar start,
Calendar end)
Gets a string describing the range of years for given calendars. |
boolean |
isJavaDefaultPackage(org.jomc.model.Implementation implementation)
Gets a flag indicating if the class of a given implementation is located in the Java default package. |
boolean |
isJavaDefaultPackage(org.jomc.model.Specification specification)
Gets a flag indicating if the class of a given specification is located in the Java default package. |
boolean |
isJavaPrimitiveType(org.jomc.model.Property property)
Gets a flag indicating if the type of a given property is a Java primitive. |
boolean |
isLoggable(Level level)
Checks if a message at a given level is provided to the listeners of the instance. |
protected void |
log(Level level,
String message,
Throwable throwable)
Notifies registered listeners. |
static void |
setDefaultLogLevel(Level value)
Sets the default log level events are logged at. |
static void |
setDefaultTemplateProfile(String value)
Sets the default template profile. |
void |
setIndentation(String value)
Sets the indentation string of the instance. |
void |
setInputEncoding(String value)
Sets the encoding to use for reading files. |
void |
setLineSeparator(String value)
Sets the line separator of the instance. |
void |
setLogLevel(Level value)
Sets the log level of the instance. |
void |
setModel(org.jomc.modlet.Model value)
Sets the model of the instance. |
void |
setOutputEncoding(String value)
Sets the encoding to use for writing files. |
void |
setTemplateEncoding(String value)
Sets the encoding to use for reading templates. |
void |
setTemplateProfile(String value)
Sets the template profile of the instance. |
void |
setVelocityEngine(org.apache.velocity.app.VelocityEngine value)
Sets the VelocityEngine of the instance. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JomcTool()
JomcTool instance.
public JomcTool(JomcTool tool)
throws IOException
JomcTool instance taking a JomcTool instance to initialize the new instance with.
tool - The instance to initialize the new instance with.NullPointerException - if tool is null.IOException - if copying tool fails.| Method Detail |
|---|
public List<JomcTool.Listener> getListeners()
This accessor method returns a reference to the live list, not a snapshot. Therefore any modification you make
to the returned list will be present inside the object. This is why there is no set method for the
listeners property.
log(java.util.logging.Level, java.lang.String, java.lang.Throwable)public static Level getDefaultLogLevel()
The default log level is controlled by system property org.jomc.tools.JomcTool.defaultLogLevel holding
the log level to log events at by default. If that property is not set, the WARNING default is
returned.
getLogLevel(),
Level.parse(java.lang.String)public static void setDefaultLogLevel(Level value)
value - The new default level events are logged at or null.getDefaultLogLevel()public final Level getLogLevel()
getDefaultLogLevel(),
setLogLevel(java.util.logging.Level),
isLoggable(java.util.logging.Level)public final void setLogLevel(Level value)
value - The new log level of the instance or null.getLogLevel(),
isLoggable(java.util.logging.Level)public boolean isLoggable(Level level)
level - The level to test.true if messages at level are provided to the listeners of the instance;
false if messages at level are not provided to the listeners of the instance.NullPointerException - if level is null.getLogLevel(),
setLogLevel(java.util.logging.Level),
log(java.util.logging.Level, java.lang.String, java.lang.Throwable)public String getJavaPackageName(org.jomc.model.Specification specification)
specification - The specification to get the Java package name of.specification or null.NullPointerException - if specification is null.
public String getJavaTypeName(org.jomc.model.Specification specification,
boolean qualified)
specification - The specification to get the Java type name of.qualified - true to return the fully qualified type name (with package name prepended);
false to return the short type name (without package name prepended).specification or null.NullPointerException - if specification is null.public String getJavaClasspathLocation(org.jomc.model.Specification specification)
specification - The specification to return the Java class path location of.specification or null.NullPointerException - if specification is null.public String getJavaPackageName(org.jomc.model.SpecificationReference reference)
reference - The specification reference to get the Java package name of.reference or null.NullPointerException - if reference is null.
public String getJavaTypeName(org.jomc.model.SpecificationReference reference,
boolean qualified)
reference - The specification reference to get a Java type name of.qualified - true to return the fully qualified type name (with package name prepended);
false to return the short type name (without package name prepended).reference or null.NullPointerException - if reference is null.public String getJavaPackageName(org.jomc.model.Implementation implementation)
implementation - The implementation to get the Java package name of.implementation or null.NullPointerException - if implementation is null.
public String getJavaTypeName(org.jomc.model.Implementation implementation,
boolean qualified)
implementation - The implementation to get the Java type name of.qualified - true to return the fully qualified type name (with package name prepended);
false to return the short type name (without package name prepended).implementation or null.NullPointerException - if implementation is null.public String getJavaClasspathLocation(org.jomc.model.Implementation implementation)
implementation - The implementation to return the Java class path location of.implementation or null.NullPointerException - if implementation is null.
public List<String> getJavaInterfaceNames(org.jomc.model.Implementation implementation,
boolean qualified)
implementation - The implementation to get all implemented Java interfaces of.qualified - true to return the fully qualified type names (with package name prepended);
false to return the short type names (without package name prepended).implementation.NullPointerException - if implementation is null.public String getJavaTypeName(org.jomc.model.Argument argument)
argument - The argument to get the Java type name of.argument.NullPointerException - if argument is null.
public String getJavaTypeName(org.jomc.model.Property property,
boolean boxify)
property - The property to get the Java type name of.boxify - true to return the name of the Java wrapper class when the type is a Java primitive type;
false to return the exact binary name (unboxed name) of the Java type.property.NullPointerException - if property is null.public boolean isJavaPrimitiveType(org.jomc.model.Property property)
property - The property to query.true if the type of property is a Java primitive; false if not.NullPointerException - if property is null.public String getJavaGetterMethodName(org.jomc.model.Property property)
property - The property to get a Java accessor method name of.property.NullPointerException - if property is null.public String getJavaTypeName(org.jomc.model.Dependency dependency)
dependency - The dependency to get a dependency Java type name of.dependency or null.NullPointerException - if dependency is null.public String getJavaGetterMethodName(org.jomc.model.Dependency dependency)
dependency - The dependency to get a Java accessor method name of.dependency.NullPointerException - if dependency is null.public String getJavaGetterMethodName(org.jomc.model.Message message)
message - The message to get a Java accessor method name of.message.NullPointerException - if message is null.
public String getJavaModifierName(org.jomc.model.Implementation implementation,
org.jomc.model.Dependency dependency)
implementation - The implementation to get a dependency Java modifier name of.dependency - The dependency to get a Java modifier name of.dependency of implementation.NullPointerException - if implementation or dependency is null.
public String getJavaModifierName(org.jomc.model.Implementation implementation,
org.jomc.model.Message message)
implementation - The implementation to get a message Java modifier name of.message - The message to get a Java modifier name of.message of implementation.NullPointerException - if implementation or message is null.
public String getJavaModifierName(org.jomc.model.Implementation implementation,
org.jomc.model.Property property)
implementation - The implementation declaring property.property - The property to get a Java modifier name for.property of implementation.NullPointerException - if implementation or property is null.
public String getJavadocComment(org.jomc.model.Text text,
int indentationLevel,
String suffix)
text - The text to format to a Javadoc comment.indentationLevel - The indentation level of the comment.suffix - The text to append to any line breaks.text formatted as a Javadoc comment.NullPointerException - if text or suffix is null.IllegalArgumentException - if indentationLevel is negative.public String getJavaString(String str)
str - The string to format to a Java string or null.str formatted as a Java string or null.public boolean isJavaDefaultPackage(org.jomc.model.Specification specification)
specification - The specification to test.true if the class of specification is located in the Java default package; false
if not.NullPointerException - if specification is null.public boolean isJavaDefaultPackage(org.jomc.model.Implementation implementation)
implementation - The implementation to test.true if the class of implementation is located in the Java default package; false
if not.NullPointerException - if implementation is null.public String getDisplayLanguage(String language)
language - The language code to get the display language of.language.NullPointerException - if language is null.public String getShortDate(Calendar calendar)
calendar - The calendar to format.calendar formatted using a short format style pattern.NullPointerException - if calendar is null.DateFormat.SHORTpublic String getLongDate(Calendar calendar)
calendar - The calendar to format.calendar formatted using a long format style pattern.NullPointerException - if calendar is null.DateFormat.LONGpublic String getShortTime(Calendar calendar)
calendar - The calendar to format.calendar formatted using a short format style pattern.NullPointerException - if calendar is null.DateFormat.SHORTpublic String getLongTime(Calendar calendar)
calendar - The calendar to format.calendar formatted using a long format style pattern.NullPointerException - if calendar is null.DateFormat.LONGpublic String getShortDateTime(Calendar calendar)
calendar - The calendar to format.calendar formatted using a short format style pattern.NullPointerException - if calendar is null.DateFormat.SHORTpublic String getLongDateTime(Calendar calendar)
calendar - The calendar to format.calendar formatted using a long format style pattern.NullPointerException - if calendar is null.DateFormat.LONG
public String getYears(Calendar start,
Calendar end)
start - The start of the range.end - The end of the range.start and end.NullPointerException - if start or end is null.public org.jomc.modlet.Model getModel()
getModules(),
setModel(org.jomc.modlet.Model)public void setModel(org.jomc.modlet.Model value)
value - The new model of the instance.getModel()public org.jomc.model.Modules getModules()
getModel(),
setModel(org.jomc.modlet.Model)
public org.apache.velocity.app.VelocityEngine getVelocityEngine()
throws IOException
VelocityEngine of the instance.
VelocityEngine of the instance.IOException - if initializing a new velocity engine fails.setVelocityEngine(org.apache.velocity.app.VelocityEngine)public void setVelocityEngine(org.apache.velocity.app.VelocityEngine value)
VelocityEngine of the instance.
value - The new VelocityEngine of the instance.getVelocityEngine()public org.apache.velocity.VelocityContext getVelocityContext()
public final String getTemplateEncoding()
setTemplateEncoding(java.lang.String)public final void setTemplateEncoding(String value)
value - The new encoding to use for reading templates or null.getTemplateEncoding()public final String getInputEncoding()
setInputEncoding(java.lang.String)public final void setInputEncoding(String value)
value - The new encoding to use for reading files or null.getInputEncoding()public final String getOutputEncoding()
setOutputEncoding(java.lang.String)public final void setOutputEncoding(String value)
value - The encoding to use for writing files or null.getOutputEncoding()public static String getDefaultTemplateProfile()
The default template profile is controlled by system property
org.jomc.tools.JomcTool.defaultTemplateProfile holding the name of the template profile to use by
default. If that property is not set, the jomc-java default is returned.
setDefaultTemplateProfile(java.lang.String)public static void setDefaultTemplateProfile(String value)
value - The new default template profile or null.getDefaultTemplateProfile()public final String getTemplateProfile()
getDefaultTemplateProfile(),
setTemplateProfile(java.lang.String)public final void setTemplateProfile(String value)
value - The new template profile of the instance or null.getTemplateProfile()public final String getIndentation()
public final String getIndentation(int level)
level - The indentation level to get an indentation string for.level.IllegalArgumentException - if level is negative.getIndentation()public final void setIndentation(String value)
value - The new indentation string of the instance or null.getIndentation()public final String getLineSeparator()
public final void setLineSeparator(String value)
value - The new line separator of the instance or null.getLineSeparator()
public org.apache.velocity.Template getVelocityTemplate(String templateName)
throws IOException
This method returns the template corresponding to the profile of the instance. If that template is not found, the template of the default profile is returned so that only templates differing from the default templates need to be provided when exchanging templates.
templateName - The name of the template to get.templateName.NullPointerException - if templateName is null.IOException - if getting the template fails.getTemplateProfile(),
getTemplateEncoding()
protected void log(Level level,
String message,
Throwable throwable)
level - The level of the event.message - The message of the event or null.throwable - The throwable of the event or null.NullPointerException - if level is null.getListeners()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||