Abstract base class for all "pragma" directives that may occur in a Mapper report
that is to be converted by MJ. A pragma embeds additional information or special
instructions useful during conversion directly into the Mapper report lines.
Pragmas are either stand alone '.' lines or part of a Mapper '@' line that contains
Mapper commands in a RUN. Stand alone pragmas apply to the line(s) immediately below the
line containing the pragma, while a pragma embedded with Mapper commands applies
to the line where the pragma is embedded.
One or more arguments may be associated with a pragma, where the argument has a
name and a value. A value may be extracted as the following types:
During parsing, arguments cannot be specified as required, or as being of
a certain type. Arguments must be validated by code that uses a pragma after
is has been parsed from a Mapper report line.
Argument names are restricted to letters, digits and underscore and may be
constructed to follow JavaBean accessor and modifier naming conventions to
facilitate population of JavaBean attributes from a pragma, but this naming
pattern is only a suggestion.
Treat this class as "thread-safe", since it is immutable after creation.
Methods |
Get pragma argument as a boolean.
- Parameters:
anArgumentName - name of argument.
- Returns:
- value of argument, or false if no such argument.
protected final boolean asBooleanArgument(java.lang.String anArgumentName)
|
Get pragma argument as a boolean. To be returned as true, the value of the
argument must be true or TRUE .
- Parameters:
anArgumentName - name of argument.
aDefaultValue - default value to return if no such argument.
- Returns:
- value of argument.
- See Also:
- Boolean.parseBoolean
protected final boolean asBooleanArgument(java.lang.String anArgumentName, boolean aDefaultValue)
|
Get pragma argument as a double.
- Parameters:
anArgumentName - name of argument.
- Throws:
MJTranslateException - if pragma argument is not a valid double.
- Returns:
- value of argument, or
Double.NaN if no such argument.
protected double asDoubleArgument(java.lang.String anArgumentName) throws com.arsi.mj.MJTranslateException
|
Get pragma argument as a double.
- Parameters:
anArgumentName - name of argument.
aDefaultValue - default value to return if no such argument.
- Throws:
MJTranslateException - if pragma argument is not a valid double.
- Returns:
- value of argument.
protected double asDoubleArgument(java.lang.String anArgumentName, double aDefaultValue) throws com.arsi.mj.MJTranslateException
|
Get pragma argument as an integer.
- Parameters:
anArgumentName - name of argument.
- Throws:
MJTranslateException - if pragma argument is not a valid integer.
- Returns:
- value of argument, or
Integer.MIN_VALUE if no such argument.
protected int asIntegerArgument(java.lang.String anArgumentName) throws com.arsi.mj.MJTranslateException
|
Get pragma argument as an integer.
- Parameters:
anArgumentName - name of argument.
aDefaultValue - default value to return if no such argument.
- Throws:
MJTranslateException - if pragma argument is not a valid integer.
- Returns:
- value of argument.
protected int asIntegerArgument(java.lang.String anArgumentName, int aDefaultValue) throws com.arsi.mj.MJTranslateException
|
Get pragma argument as a string.
- Parameters:
anArgumentName - name of argument.
- Returns:
- value of argument, or NULL if no such argument.
protected final java.lang.String asStringArgument(java.lang.String anArgumentName)
|
Get pragma argument as a string.
- Parameters:
anArgumentName - name of argument.
aDefaultValue - default value to return if no such argument.
- Returns:
- value of argument.
protected final java.lang.String asStringArgument(java.lang.String anArgumentName, java.lang.String aDefaultValue)
|
Determine if pragma argument exists.
- Parameters:
anArgumentName - name of argument.
- Returns:
- true if argument exists, false if not.
protected final boolean doesArgumentExist(java.lang.String anArgumentName)
|
By default, pragmas are equal if they have the same name.
- See Also:
- java.lang.Object#equals(java.lang.Object)
public boolean equals(java.lang.Object anObject)
|
Get arguments included in pragma directive, if any.
- Returns:
- map of argument names to values (Java primitive wrappers, e.g.,
Integer );
if pragma has no arguments, an empty map is returned.
public final java.util.Map getArguments()
|
Get name of pragma as embedded in the Mapper report.
- Returns:
- name of pragma.
public final java.lang.String getName()
|
public int hashCode()
|
Indicates if pragma occurs on a line by itself.
- Returns:
- true if pragma occurs on a line by itself, false if pragma is appended
to Mapper source code as a comment in at-sign line.
public final boolean isStandalone()
|
Validate this pragma, e.g., verify that any required arguments exist.
- Throws:
MJTranslateException - if validation error occurs that is reported via an exception.
- Returns:
- true if pragma is valid, false if pragma is not valid.
public abstract boolean validate() throws com.arsi.mj.MJTranslateException
|