public class JomcTool extends Object
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 |
---|---|
String |
getBooleanString(Boolean b)
Formats a
Boolean to a string. |
String |
getCsvString(String str)
Formats a string to a CSV string.
|
static Level |
getDefaultLogLevel()
Gets the default log level events are logged at.
|
String |
getDefaultTemplateEncoding()
Gets the default encoding used for reading templates.
|
static String |
getDefaultTemplateProfile()
Deprecated.
The
static modifier of this method and support to setup the default template profile using
a system property will be removed in version 2.0. |
String |
getDisplayLanguage(String language)
Gets the display language of a given language code.
|
String |
getHtmlString(String str)
Formats a string to a HTML string with HTML entities.
|
List<String> |
getImplementedJavaTypeNames(Implementation implementation,
boolean qualified)
Deprecated.
As of JOMC 1.4, please use method
Modules.getImplementedJavaTypeNames(java.lang.String) .
This method will be removed in JOMC 2.0. |
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 |
getIsoDate(Calendar calendar)
Formats a calendar instance to a string.
|
String |
getIsoDateTime(Calendar calendar)
Formats a calendar instance to a string.
|
String |
getIsoTime(Calendar calendar)
Formats a calendar instance to a string.
|
String |
getJavaClasspathLocation(Implementation implementation)
Deprecated.
As of JOMC 1.4, please use method
Implementation.getJavaTypeName() . This method will be
removed in JOMC 2.0. |
String |
getJavaClasspathLocation(Specification specification)
Deprecated.
As of JOMC 1.4, please use method
Specification.getJavaTypeName() . This method will be
removed in JOMC 2.0. |
String |
getJavaClasspathLocation(String str,
boolean absolute)
Deprecated.
As of JOMC 1.4, please use
JavaTypeName.getQualifiedName() . This method will be removed in
JOMC 2.0. |
String |
getJavaConstantName(String str)
Deprecated.
As of JOMC 1.4, please use method
toJavaConstantName(java.lang.String) . This method will be
removed in JOMC 2.0. |
String |
getJavadocComment(Text text,
int indentationLevel,
String linePrefix)
Deprecated.
As of JOMC 1.4, please use method
Text.getJavadocComment(java.lang.String, java.lang.String) .
This method will be removed in JOMC 2.0. |
String |
getJavadocComment(Texts texts,
int indentationLevel,
String linePrefix)
Deprecated.
As of JOMC 1.4, please use method
Text.getJavadocComment(java.lang.String, java.lang.String) .
This method will be removed in JOMC 2.0. |
String |
getJavaFieldName(Dependency dependency)
Deprecated.
As of JOMC 1.4, please use method
Dependency.getJavaVariableName() . This method will be
removed in JOMC 2.0. |
String |
getJavaFieldName(Message message)
Deprecated.
As of JOMC 1.4, please use method
Message.getJavaVariableName() . This method will be removed
in JOMC 2.0. |
String |
getJavaFieldName(Property property)
Deprecated.
As of JOMC 1.4, please use method
Property.getJavaVariableName() . This method will be removed
in JOMC 2.0. |
String |
getJavaFieldName(String str)
Deprecated.
As of JOMC 1.4, please use method
toJavaVariableName(java.lang.String) . This method will be
removed in JOMC 2.0. |
String |
getJavaGetterMethodName(Dependency dependency)
Deprecated.
As of JOMC 1.4, please use method
Dependency.getJavaGetterMethodName() . This method will be
removed in JOMC 2.0. |
String |
getJavaGetterMethodName(Message message)
Deprecated.
As of JOMC 1.4, please use method
Message.getJavaGetterMethodName() . This method will be
removed in JOMC 2.0. |
String |
getJavaGetterMethodName(Property property)
Deprecated.
As of JOMC 1.4, please use method
Property.getJavaGetterMethodName() . This method will be
removed in JOMC 2.0. |
String |
getJavaIdentifier(String str,
boolean capitalize)
Deprecated.
As of JOMC 1.4, please use method
toJavaVariableName(java.lang.String) . This method will be
removed in JOMC 2.0. |
List<String> |
getJavaInterfaceNames(Implementation implementation,
boolean qualified)
Deprecated.
As of JOMC 1.2, replaced by method
getImplementedJavaTypeNames(org.jomc.model.Implementation, boolean) .
This method will be removed in version 2.0. |
String |
getJavaMethodParameterName(Argument argument)
Deprecated.
As of JOMC 1.4, please use method
Argument.getJavaVariableName() . This method will be
removed in JOMC 2.0. |
String |
getJavaMethodParameterName(Dependency dependency)
Deprecated.
As of JOMC 1.4, please use method
Dependency.getJavaVariableName() . This method will be
removed in JOMC 2.0. |
String |
getJavaMethodParameterName(Message message)
Deprecated.
As of JOMC 1.4, please use method
Message.getJavaVariableName() . This method will be removed
in JOMC 2.0. |
String |
getJavaMethodParameterName(Property property)
Deprecated.
As of JOMC 1.4, please use method
Property.getJavaVariableName() . This method will be
removed in JOMC 2.0. |
String |
getJavaMethodParameterName(String str)
Deprecated.
As of JOMC 1.4, please use method
toJavaVariableName(java.lang.String) . This method will be
removed in JOMC 2.0. |
String |
getJavaModifierName(Implementation implementation,
Dependency dependency)
Deprecated.
As of JOMC 1.4, please use method
Modules.getDependencyJavaModifierName(java.lang.String, java.lang.String) .
This method will be removed in JOMC 2.0. |
String |
getJavaModifierName(Implementation implementation,
Message message)
Deprecated.
As of JOMC 1.4, please use method
Modules.getMessageJavaModifierName(java.lang.String, java.lang.String) .
This method will be removed in JOMC 2.0. |
String |
getJavaModifierName(Implementation implementation,
Property property)
Deprecated.
As of JOMC 1.4, please use method
Modules.getPropertyJavaModifierName(java.lang.String, java.lang.String) .
This method will be removed in JOMC 2.0. |
String |
getJavaPackageName(Implementation implementation)
Deprecated.
As of JOMC 1.4, please use method
Implementation.getJavaTypeName() . This method will be
removed in JOMC 2.0. |
String |
getJavaPackageName(Specification specification)
Deprecated.
As of JOMC 1.4, please use method
Specification.getJavaTypeName() . This method will be
removed in JOMC 2.0. |
String |
getJavaPackageName(SpecificationReference reference)
Deprecated.
As of JOMC 1.4, please use method
Specification.getJavaTypeName() . This method will be
removed in JOMC 2.0. |
String |
getJavaScriptString(String str)
Formats a string to a JavaScript string applying JavaScript string rules.
|
String |
getJavaSetterMethodName(Dependency dependency)
Deprecated.
As of JOMC 1.4, please use method
Dependency.getJavaSetterMethodName() . This method will be
removed in JOMC 2.0. |
String |
getJavaSetterMethodName(Message message)
Deprecated.
As of JOMC 1.4, please use method
Message.getJavaSetterMethodName() . This method will be
removed in JOMC 2.0. |
String |
getJavaSetterMethodName(Property property)
Deprecated.
As of JOMC 1.4, please use method
Property.getJavaSetterMethodName() . This method will be
removed in JOMC 2.0. |
String |
getJavaString(String str)
Formats a string to a Java string with unicode escapes.
|
String |
getJavaTypeName(Argument argument)
Deprecated.
As of JOMC 1.4, please use method
Argument.getJavaTypeName() . This method will be removed in
JOMC 2.0. |
String |
getJavaTypeName(Dependency dependency)
Deprecated.
As of JOMC 1.4, please use method
Modules.getDependencyJavaTypeName(java.lang.String, java.lang.String) .
This method will be removed in JOMC 2.0. |
String |
getJavaTypeName(Implementation implementation,
boolean qualified)
Deprecated.
As of JOMC 1.4, please use method
Implementation.getJavaTypeName() . This method will be
removed in JOMC 2.0. |
String |
getJavaTypeName(Property property,
boolean boxify)
Deprecated.
As of JOMC 1.4, please use method
Property.getJavaTypeName() . This method will be removed in
JOMC 2.0. |
String |
getJavaTypeName(Specification specification,
boolean qualified)
Deprecated.
As of JOMC 1.4, please use method
Specification.getJavaTypeName() . This method will be
removed in JOMC 2.0. |
String |
getJavaTypeName(SpecificationReference reference,
boolean qualified)
Deprecated.
As of JOMC 1.4, please use method
Specification.getJavaTypeName() . This method will be
removed in JOMC 2.0. |
String |
getLineSeparator()
Gets the line separator of the instance.
|
List<JomcTool.Listener> |
getListeners()
Gets the list of registered listeners.
|
Locale |
getLocale()
Gets the locale of the instance.
|
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.
|
String |
getMediumDate(Calendar calendar)
Formats a calendar instance to a string.
|
String |
getMediumDateTime(Calendar calendar)
Formats a calendar instance to a string.
|
String |
getMediumTime(Calendar calendar)
Formats a calendar instance to a string.
|
Model |
getModel()
Gets the model of the instance.
|
Modules |
getModules()
Gets the modules of the model of the instance.
|
String |
getOutputEncoding()
Gets the encoding to use for writing files.
|
String |
getParentTemplateProfile(String tp)
Gets the parent template profile of a given template profile.
|
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 |
getSqlString(String str)
Formats a string to a SQL string.
|
String |
getTemplateEncoding()
Deprecated.
As of JOMC 1.3, replaced by method
getDefaultTemplateEncoding() . This method will be removed
in JOMC 2.0. |
String |
getTemplateEncoding(String tp)
Gets the template encoding of a given template profile.
|
URL |
getTemplateLocation()
Gets the location to search for templates in addition to searching the class path.
|
Map<String,Object> |
getTemplateParameters()
Gets the template parameters of the instance.
|
String |
getTemplateProfile()
Gets the template profile of the instance.
|
VelocityContext |
getVelocityContext()
Gets a new velocity context used for merging templates.
|
VelocityEngine |
getVelocityEngine()
Gets the
VelocityEngine of the instance. |
Template |
getVelocityTemplate(String templateName)
Gets a velocity template for a given name.
|
String |
getXmlString(String str)
Formats a string to a XML string with XML entities.
|
String |
getYears(Calendar start,
Calendar end)
Gets a string describing the range of years for given calendars.
|
boolean |
isJavaDefaultPackage(Implementation implementation)
Deprecated.
As of JOMC 1.4, please use method
Implementation.getJavaTypeName() . This method will be
removed in JOMC 2.0. |
boolean |
isJavaDefaultPackage(Specification specification)
Deprecated.
As of JOMC 1.4, please use method
Specification.getJavaTypeName() . This method will be
removed in JOMC 2.0. |
boolean |
isJavaPrimitiveType(Property property)
Deprecated.
As of JOMC 1.4, please use method
Property.getJavaTypeName() . This method will be removed in
JOMC 2.0. |
boolean |
isLoggable(Level level)
Checks if a message at a given level is provided to the listeners of the instance.
|
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.
|
void |
setDefaultTemplateEncoding(String value)
Sets the default encoding to use for reading templates.
|
static void |
setDefaultTemplateProfile(String value)
Deprecated.
The
static modifier of this method will be removed in version 2.0. |
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 |
setLocale(Locale value)
Sets the locale of the instance.
|
void |
setLogLevel(Level value)
Sets the log level of the instance.
|
void |
setModel(Model value)
Sets the model of the instance.
|
void |
setOutputEncoding(String value)
Sets the encoding to use for writing files.
|
void |
setTemplateEncoding(String value)
Deprecated.
As of JOMC 1.3, replaced by method
setDefaultTemplateEncoding(java.lang.String) . This method
will be removed in JOMC 2.0. |
void |
setTemplateLocation(URL value)
Sets the location to search for templates in addition to searching the class path.
|
void |
setTemplateProfile(String value)
Sets the template profile of the instance.
|
void |
setVelocityEngine(VelocityEngine value)
Sets the
VelocityEngine of the instance. |
JavaIdentifier |
toJavaConstantName(String str)
Compiles a string to a Java constant name.
|
JavaIdentifier |
toJavaMethodName(String str)
Compiles a string to a Java method name.
|
JavaIdentifier |
toJavaVariableName(String str)
Compiles a string to a Java variable name.
|
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.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)
@Deprecated public String getJavaPackageName(Specification specification) throws ModelObjectException
Specification.getJavaTypeName()
. This method will be
removed in JOMC 2.0.specification
- The specification to get the Java package name of.specification
or null
, if the specification does not reference a
type.NullPointerException
- if specification
is null
.ModelObjectException
- if compiling the name of the referenced type to a JavaTypeName
fails.Specification.getJavaTypeName()
,
JavaTypeName.getPackageName()
@Deprecated public String getJavaTypeName(Specification specification, boolean qualified) throws ModelObjectException
Specification.getJavaTypeName()
. This method will be
removed in JOMC 2.0.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).null
, if the specification does
not reference a type.NullPointerException
- if specification
is null
.ModelObjectException
- if compiling the name of the referenced type to a JavaTypeName
fails.Specification.getJavaTypeName()
,
JavaTypeName.getName(boolean)
@Deprecated public String getJavaClasspathLocation(Specification specification) throws ModelObjectException
Specification.getJavaTypeName()
. This method will be
removed in JOMC 2.0.specification
- The specification to return the Java class path location of.specification
or null
, if the specification does not
reference a type.NullPointerException
- if specification
is null
.ModelObjectException
- if compiling the name of the referenced type to a JavaTypeName
fails.Specification.getJavaTypeName()
,
JavaTypeName.getQualifiedName()
@Deprecated public String getJavaPackageName(SpecificationReference reference) throws ModelObjectException
Specification.getJavaTypeName()
. This method will be
removed in JOMC 2.0.reference
- The specification reference to get the Java package name of.reference
or null
, if the referenced specification is not found
or does not reference a type.NullPointerException
- if reference
is null
.ModelObjectException
- if compiling the name of the referenced type to a JavaTypeName
fails.Modules.getSpecification(java.lang.String)
,
Specification.getJavaTypeName()
,
JavaTypeName.getPackageName()
@Deprecated public String getJavaTypeName(SpecificationReference reference, boolean qualified) throws ModelObjectException
Specification.getJavaTypeName()
. This method will be
removed in JOMC 2.0.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
, if the referenced specification is not found
or does not reference a type.NullPointerException
- if reference
is null
.ModelObjectException
- if compiling the name of the referenced type to a JavaTypeName
fails.Modules.getSpecification(java.lang.String)
,
Specification.getJavaTypeName()
,
JavaTypeName.getName(boolean)
@Deprecated public String getJavaPackageName(Implementation implementation) throws ModelObjectException
Implementation.getJavaTypeName()
. This method will be
removed in JOMC 2.0.implementation
- The implementation to get the Java package name of.implementation
or null
, if the implementation does not reference
a type.NullPointerException
- if implementation
is null
.ModelObjectException
- if compiling the name of the referenced type to a JavaTypeName
fails.Implementation.getJavaTypeName()
,
JavaTypeName.getPackageName()
@Deprecated public String getJavaTypeName(Implementation implementation, boolean qualified) throws ModelObjectException
Implementation.getJavaTypeName()
. This method will be
removed in JOMC 2.0.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).null
, if the implementation
does not reference a type.NullPointerException
- if implementation
is null
.ModelObjectException
- if compiling the name of the referenced type to a JavaTypeName
fails.Implementation.getJavaTypeName()
,
JavaTypeName.getName(boolean)
@Deprecated public String getJavaClasspathLocation(Implementation implementation) throws ModelObjectException
Implementation.getJavaTypeName()
. This method will be
removed in JOMC 2.0.implementation
- The implementation to return the Java class path location of.implementation
or null
, if the implementation does not
reference a type.NullPointerException
- if implementation
is null
.ModelObjectException
- if compiling the name of the referenced type to a JavaTypeName
fails.Implementation.getJavaTypeName()
,
JavaTypeName.getQualifiedName()
@Deprecated public List<String> getJavaInterfaceNames(Implementation implementation, boolean qualified) throws ModelObjectException
getImplementedJavaTypeNames(org.jomc.model.Implementation, boolean)
.
This method will be removed in version 2.0.implementation
- The implementation to get names of all implemented Java types 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
.ModelObjectException
- if compiling the name of a referenced type to a JavaTypeName
fails.@Deprecated public List<String> getImplementedJavaTypeNames(Implementation implementation, boolean qualified) throws ModelObjectException
Modules.getImplementedJavaTypeNames(java.lang.String)
.
This method will be removed in JOMC 2.0.implementation
- The implementation to get names of all implemented Java types 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
.ModelObjectException
- if compiling the name of the referenced type to a JavaTypeName
fails.@Deprecated public String getJavaTypeName(Argument argument) throws ModelObjectException
Argument.getJavaTypeName()
. This method will be removed in
JOMC 2.0.argument
- The argument to get the Java type name of.null
, if the argument does not
reference a type.NullPointerException
- if argument
is null
.ModelObjectException
- if compiling the name of the referenced type to a JavaTypeName
fails.Argument.getJavaTypeName()
,
JavaTypeName.getName(boolean)
@Deprecated public String getJavaMethodParameterName(Argument argument) throws ModelObjectException
Argument.getJavaVariableName()
. This method will be
removed in JOMC 2.0.argument
- The argument to get the Java method parameter name of.argument
.NullPointerException
- if argument
is null
.ModelObjectException
- if compiling the name of the argument to a JavaIdentifier
fails.Argument.getJavaVariableName()
@Deprecated public String getJavaTypeName(Property property, boolean boxify) throws ModelObjectException
Property.getJavaTypeName()
. This method will be removed in
JOMC 2.0.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.null
, if the property does not
reference a type.NullPointerException
- if property
is null
.ModelObjectException
- if compiling the name of the referenced type to a JavaTypeName
fails.Property.getJavaTypeName()
,
JavaTypeName.getBoxedName()
,
JavaTypeName.getName(boolean)
@Deprecated public boolean isJavaPrimitiveType(Property property) throws ModelObjectException
Property.getJavaTypeName()
. This method will be removed in
JOMC 2.0.property
- The property to query.true
, if the Java type referenced by the property is primitive or false
, if the property
does not reference a type or if the Java type referenced by the property is not primitive.NullPointerException
- if property
is null
.ModelObjectException
- if compiling the name of the referenced type to a JavaTypeName
fails.Property.getJavaTypeName()
,
JavaTypeName.isPrimitive()
@Deprecated public String getJavaGetterMethodName(Property property) throws ModelObjectException
Property.getJavaGetterMethodName()
. This method will be
removed in JOMC 2.0.property
- The property to get a Java getter method name of.property
.NullPointerException
- if property
is null
.ModelObjectException
- if compiling the name of the property to a JavaIdentifier
fails.Property.getJavaGetterMethodName()
@Deprecated public String getJavaSetterMethodName(Property property) throws ModelObjectException
Property.getJavaSetterMethodName()
. This method will be
removed in JOMC 2.0.property
- The property to get a Java setter method name of.property
.NullPointerException
- if property
is null
.ModelObjectException
- if compiling the name of the property to a JavaIdentifier
fails.Property.getJavaSetterMethodName()
@Deprecated public String getJavaMethodParameterName(Property property) throws ModelObjectException
Property.getJavaVariableName()
. This method will be
removed in JOMC 2.0.property
- The property to get the Java method parameter name of.property
.NullPointerException
- if property
is null
.ModelObjectException
- if copmiling the name of the property to a JavaIdentifier
fails.Property.getJavaVariableName()
@Deprecated public String getJavaFieldName(Property property) throws ModelObjectException
Property.getJavaVariableName()
. This method will be removed
in JOMC 2.0.property
- The property to get the Java field name of.property
.NullPointerException
- if property
is null
.ModelObjectException
- if compiling the name of the property to a JavaIdentifier
fails.Property.getJavaVariableName()
@Deprecated public String getJavaTypeName(Dependency dependency) throws ModelObjectException
Modules.getDependencyJavaTypeName(java.lang.String, java.lang.String)
.
This method will be removed in JOMC 2.0.dependency
- The dependency to get a dependency Java type name of.null
, if the referenced specification is not found or
does not reference a type.NullPointerException
- if dependency
is null
.ModelObjectException
- if compiling the name of the referenced type to a JavaTypeName
fails.@Deprecated public String getJavaGetterMethodName(Dependency dependency) throws ModelObjectException
Dependency.getJavaGetterMethodName()
. This method will be
removed in JOMC 2.0.dependency
- The dependency to get a Java getter method name of.dependency
.NullPointerException
- if dependency
is null
.ModelObjectException
- if compiling the name of the dependency to a JavaIdentifier
fails.Dependency.getJavaGetterMethodName()
@Deprecated public String getJavaSetterMethodName(Dependency dependency) throws ModelObjectException
Dependency.getJavaSetterMethodName()
. This method will be
removed in JOMC 2.0.dependency
- The dependency to get a Java setter method name of.dependency
.NullPointerException
- if dependency
is null
.ModelObjectException
- if compiling the name of the dependency to a JavaIdentifier
fails.Dependency.getJavaSetterMethodName()
@Deprecated public String getJavaMethodParameterName(Dependency dependency) throws ModelObjectException
Dependency.getJavaVariableName()
. This method will be
removed in JOMC 2.0.dependency
- The dependency to get the Java method parameter name of.dependency
.NullPointerException
- if dependency
is null
.ModelObjectException
- if compiling the name of the dependency to a JavaIdentifier
fails.Dependency.getJavaVariableName()
@Deprecated public String getJavaFieldName(Dependency dependency) throws ModelObjectException
Dependency.getJavaVariableName()
. This method will be
removed in JOMC 2.0.dependency
- The dependency to get the Java field name of.dependency
.NullPointerException
- if dependency
is null
.ModelObjectException
- if compiling the name of the dependency to a JavaIdentifier
fails.Dependency.getJavaVariableName()
@Deprecated public String getJavaGetterMethodName(Message message) throws ModelObjectException
Message.getJavaGetterMethodName()
. This method will be
removed in JOMC 2.0.message
- The message to get a Java getter method name of.message
.NullPointerException
- if message
is null
.ModelObjectException
- if compiling the name of the message to a JavaIdentifier
fails.Message.getJavaGetterMethodName()
@Deprecated public String getJavaSetterMethodName(Message message) throws ModelObjectException
Message.getJavaSetterMethodName()
. This method will be
removed in JOMC 2.0.message
- The message to get a Java setter method name of.message
.NullPointerException
- if message
is null
.ModelObjectException
- if compiling the name of the message to a JavaIdentifier
fails.Message.getJavaSetterMethodName()
@Deprecated public String getJavaMethodParameterName(Message message) throws ModelObjectException
Message.getJavaVariableName()
. This method will be removed
in JOMC 2.0.message
- The message to get the Java method parameter name of.message
.NullPointerException
- if message
is null
.ModelObjectException
- if compiling the name of the message to a JavaIdentifier
fails.Message.getJavaVariableName()
@Deprecated public String getJavaFieldName(Message message) throws ModelObjectException
Message.getJavaVariableName()
. This method will be removed
in JOMC 2.0.message
- The message to get the Java field name of.message
.NullPointerException
- if message
is null
.ModelObjectException
- if compiling the name of the message to a JavaIdentifier
fails.Message.getJavaVariableName()
@Deprecated public String getJavaModifierName(Implementation implementation, Dependency dependency)
Modules.getDependencyJavaModifierName(java.lang.String, java.lang.String)
.
This method will be removed in JOMC 2.0.implementation
- The implementation declaring the dependency to get a Java modifier name of.dependency
- The dependency to get a Java modifier name of.dependency
of implementation
.NullPointerException
- if implementation
or dependency
is null
.@Deprecated public String getJavaModifierName(Implementation implementation, Message message)
Modules.getMessageJavaModifierName(java.lang.String, java.lang.String)
.
This method will be removed in JOMC 2.0.implementation
- The implementation declaring the message to get a Java modifier name of.message
- The message to get a Java modifier name of.message
of implementation
.NullPointerException
- if implementation
or message
is null
.@Deprecated public String getJavaModifierName(Implementation implementation, Property property)
Modules.getPropertyJavaModifierName(java.lang.String, java.lang.String)
.
This method will be removed in JOMC 2.0.implementation
- The implementation declaring the property to get a Java modifier name of.property
- The property to get a Java modifier name of.property
of implementation
.NullPointerException
- if implementation
or property
is null
.@Deprecated public String getJavadocComment(Text text, int indentationLevel, String linePrefix) throws ModelObjectException
Text.getJavadocComment(java.lang.String, java.lang.String)
.
This method will be removed in JOMC 2.0.text
- The text to format to a Javadoc comment.indentationLevel
- The indentation level of the comment.linePrefix
- The text to prepend lines with.text
formatted to a Javadoc comment.NullPointerException
- if text
or linePrefix
is null
.IllegalArgumentException
- if indentationLevel
is negative.ModelObjectException
- if compiling the type of the text to a MimeType
fails.@Deprecated public String getJavadocComment(Texts texts, int indentationLevel, String linePrefix) throws ModelObjectException
Text.getJavadocComment(java.lang.String, java.lang.String)
.
This method will be removed in JOMC 2.0.texts
- The list of texts to format to a Javadoc comment.indentationLevel
- The indentation level of the comment.linePrefix
- The text to prepend lines with.NullPointerException
- if texts
or linePrefix
is null
.IllegalArgumentException
- if indentationLevel
is negative.ModelObjectException
- if compiling a referenced type to a MimeType
fails.getLocale()
public String getJavaString(String str)
str
- The string to format to a Java string or null
.str
formatted to a Java string or null
.StringEscapeUtils.escapeJava(java.lang.String)
@Deprecated public String getJavaClasspathLocation(String str, boolean absolute)
JavaTypeName.getQualifiedName()
. This method will be removed in
JOMC 2.0.str
- The string to format or null
.absolute
- true
to return an absolute class path location; false
to return a relative
class path location.str
formatted to a Java class path location.@Deprecated public String getJavaIdentifier(String str, boolean capitalize)
toJavaVariableName(java.lang.String)
. This method will be
removed in JOMC 2.0.str
- The string to format or null
.capitalize
- true
, to return an identifier with the first character upper cased; false
, to
return an identifier with the first character lower cased.str
formatted to a Java identifier or null
.@Deprecated public String getJavaMethodParameterName(String str)
toJavaVariableName(java.lang.String)
. This method will be
removed in JOMC 2.0.str
- The string to format or null
.str
formatted to a Java method parameter name or null
.@Deprecated public String getJavaFieldName(String str)
toJavaVariableName(java.lang.String)
. This method will be
removed in JOMC 2.0.str
- The string to format or null
.str
formatted to a Java field name or null
.@Deprecated public String getJavaConstantName(String str)
toJavaConstantName(java.lang.String)
. This method will be
removed in JOMC 2.0.str
- The string to format or null
.str
formatted to a Java constant name or null
.public JavaIdentifier toJavaConstantName(String str) throws ParseException
str
- The string to compile or null
.str
compiled to a JavaIdentifier
or null
, if str
is null
.ParseException
- if compiling str
to a JavaIdentifier
fails.JavaIdentifier.normalize(java.lang.String, org.jomc.model.JavaIdentifier.NormalizationMode)
,
JavaIdentifier.NormalizationMode.CONSTANT_NAME_CONVENTION
public JavaIdentifier toJavaMethodName(String str) throws ParseException
str
- The string to compile or null
.str
compiled to a JavaIdentifier
or null
, if str
is null
.ParseException
- if compiling str
to a JavaIdentifier
fails.JavaIdentifier.normalize(java.lang.String, org.jomc.model.JavaIdentifier.NormalizationMode)
,
JavaIdentifier.NormalizationMode.METHOD_NAME_CONVENTION
public JavaIdentifier toJavaVariableName(String str) throws ParseException
str
- The string to compile or null
.str
compiled to a JavaIdentifier
or null
, if str
is null
.ParseException
- if compiling str
to a JavaIdentifier
fails.JavaIdentifier.normalize(java.lang.String, org.jomc.model.JavaIdentifier.NormalizationMode)
,
JavaIdentifier.NormalizationMode.VARIABLE_NAME_CONVENTION
@Deprecated public boolean isJavaDefaultPackage(Specification specification) throws ModelObjectException
Specification.getJavaTypeName()
. This method will be
removed in JOMC 2.0.specification
- The specification to query.true
, if the type referenced by specification
is located in an unnamed Java package;
false
, if the specification does not reference a type or if the referenced type is not located in an
unnamed Java package.NullPointerException
- if specification
is null
.ModelObjectException
- if compiling the name of the referenced type to a JavaTypeName
fails.Specification.getJavaTypeName()
,
JavaTypeName.isUnnamedPackage()
@Deprecated public boolean isJavaDefaultPackage(Implementation implementation) throws ModelObjectException
Implementation.getJavaTypeName()
. This method will be
removed in JOMC 2.0.implementation
- The implementation to query.true
, if the type referenced by implementation
is located in an unnamed Java package;
false
, if the implementation does not reference a type or if the referenced type is not located in an
unnamed Java package.NullPointerException
- if implementation
is null
.ModelObjectException
- if compiling the name of the referenced type to a JavaTypeName
fails.Implementation.getJavaTypeName()
,
JavaTypeName.isUnnamedPackage()
public String getHtmlString(String str)
str
- The string to format to a HTML string with HTML entities or null
.str
formatted to a HTML string with HTML entities or null
.public String getXmlString(String str)
str
- The string to format to a XML string with XML entities or null
.str
formatted to a XML string with XML entities or null
.StringEscapeUtils.escapeXml(java.lang.String)
public String getJavaScriptString(String str)
str
- The string to format to a JavaScript string by applying JavaScript string rules or null
.str
formatted to a JavaScript string with JavaScript string rules applied or null
.StringEscapeUtils.escapeJavaScript(java.lang.String)
public String getSqlString(String str)
str
- The string to format to a SQL string or null
.str
formatted to a SQL string or null
.StringEscapeUtils.escapeSql(java.lang.String)
public String getCsvString(String str)
str
- The string to format to a CSV string or null
.str
formatted to a CSV string or null
.StringEscapeUtils.escapeCsv(java.lang.String)
public String getBooleanString(Boolean b)
Boolean
to a string.b
- The Boolean
to format to a string or null
.b
formatted to a string.getLocale()
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 to a string.calendar
formatted using a short format style pattern.NullPointerException
- if calendar
is null
.DateFormat.SHORT
public String getMediumDate(Calendar calendar)
calendar
- The calendar to format to a string.calendar
formatted using a medium format style pattern.NullPointerException
- if calendar
is null
.DateFormat.MEDIUM
public String getLongDate(Calendar calendar)
calendar
- The calendar to format to a string.calendar
formatted using a long format style pattern.NullPointerException
- if calendar
is null
.DateFormat.LONG
public String getIsoDate(Calendar calendar)
calendar
- The calendar to format to a string.calendar
formatted using an ISO-8601 format style.NullPointerException
- if calendar
is null
.yyyy-DDD
public String getShortTime(Calendar calendar)
calendar
- The calendar to format to a string.calendar
formatted using a short format style pattern.NullPointerException
- if calendar
is null
.DateFormat.SHORT
public String getMediumTime(Calendar calendar)
calendar
- The calendar to format to a string.calendar
formatted using a medium format style pattern.NullPointerException
- if calendar
is null
.DateFormat.MEDIUM
public String getLongTime(Calendar calendar)
calendar
- The calendar to format to a string.calendar
formatted using a long format style pattern.NullPointerException
- if calendar
is null
.DateFormat.LONG
public String getIsoTime(Calendar calendar)
calendar
- The calendar to format to a string.calendar
formatted using an ISO-8601 format style.NullPointerException
- if calendar
is null
.HH:mm
public String getShortDateTime(Calendar calendar)
calendar
- The calendar to format to a string.calendar
formatted using a short format style pattern.NullPointerException
- if calendar
is null
.DateFormat.SHORT
public String getMediumDateTime(Calendar calendar)
calendar
- The calendar to format to a string.calendar
formatted using a medium format style pattern.NullPointerException
- if calendar
is null
.DateFormat.MEDIUM
public String getLongDateTime(Calendar calendar)
calendar
- The calendar to format to a string.calendar
formatted using a long format style pattern.NullPointerException
- if calendar
is null
.DateFormat.LONG
public String getIsoDateTime(Calendar calendar)
calendar
- The calendar to format to a string.calendar
formatted using a ISO-8601 format style.NullPointerException
- if calendar
is null
.yyyy-MM-dd'T'HH:mm:ssZ
public String getYears(Calendar start, Calendar end)
start
- The start of the range.end
- The end of the range.start
and end
(e.g. "start - end"
).NullPointerException
- if start
or end
is null
.public final Model getModel()
getModules()
,
setModel(org.jomc.modlet.Model)
public final void setModel(Model value)
value
- The new model of the instance or null
.getModel()
public final Modules getModules()
null
, if no modules are found.getModel()
,
setModel(org.jomc.modlet.Model)
public final 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 final void setVelocityEngine(VelocityEngine value)
VelocityEngine
of the instance.value
- The new VelocityEngine
of the instance or null
.getVelocityEngine()
public VelocityContext getVelocityContext() throws IOException
IOException
- if creating a new context instance fails.getTemplateParameters()
public final Map<String,Object> getTemplateParameters()
This accessor method returns a reference to the live map, not a snapshot. Therefore any modification you make
to the returned map will be present inside the object. This is why there is no set
method for the
template parameters property.
getVelocityContext()
public final URL getTemplateLocation()
null
.setTemplateLocation(java.net.URL)
public final void setTemplateLocation(URL value)
value
- The new location to search for templates in addition to searching the class path or null
.getTemplateLocation()
@Deprecated public final String getTemplateEncoding()
getDefaultTemplateEncoding()
. This method will be removed
in JOMC 2.0.setTemplateEncoding(java.lang.String)
@Deprecated public final void setTemplateEncoding(String value)
setDefaultTemplateEncoding(java.lang.String)
. This method
will be removed in JOMC 2.0.value
- The new encoding to use for reading templates or null
.getTemplateEncoding()
public final String getDefaultTemplateEncoding()
setDefaultTemplateEncoding(java.lang.String)
public final void setDefaultTemplateEncoding(String value)
value
- The new default encoding to use for reading templates or null
.getDefaultTemplateEncoding()
public final String getTemplateEncoding(String tp)
tp
- The template profile to get the template encoding of.tp
or the default template encoding
if no such encoding is defined.NullPointerException
- if tp
is null
.getDefaultTemplateEncoding()
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()
@Deprecated public static String getDefaultTemplateProfile()
static
modifier of this method and support to setup the default template profile using
a system property will be removed in version 2.0.The default template profile is the implicit parent profile of any template profile not specifying a parent template profile.
setDefaultTemplateProfile(java.lang.String)
@Deprecated public static void setDefaultTemplateProfile(String value)
static
modifier of this method will be removed in version 2.0.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 getParentTemplateProfile(String tp)
tp
- The template profile to get the parent template profile of.tp
; the default template
profile, if no such parent template profile is defined; null
, if tp
denotes the default template
profile.NullPointerException
- if tp
is null
.getDefaultTemplateProfile()
public final String getIndentation()
setIndentation(java.lang.String)
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()
setLineSeparator(java.lang.String)
public final void setLineSeparator(String value)
value
- The new line separator of the instance or null
.getLineSeparator()
public final Locale getLocale()
setLocale(java.util.Locale)
public final void setLocale(Locale value)
value
- The new locale of the instance or null
.getLocale()
public Template getVelocityTemplate(String templateName) throws FileNotFoundException, IOException
This method searches templates at the following locations recursively in the shown order stopping whenever a matching template is found.
org/jomc/tools/templates/profile
/language
/templateName
org/jomc/tools/templates/parent profile
/language
/templateName
org/jomc/tools/templates/profile
/templateName
org/jomc/tools/templates/parent profile
/language
/templateName
templateName
- The name of the template to get.templateName
.NullPointerException
- if templateName
is null
.FileNotFoundException
- if no such template is found.IOException
- if getting the template fails.getTemplateProfile()
,
getParentTemplateProfile(java.lang.String)
,
getLocale()
,
getTemplateEncoding(java.lang.String)
,
getVelocityEngine()
public 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()
,
isLoggable(java.util.logging.Level)
Copyright © 2005–2015 The JOMC Project. All rights reserved.