Follow the links below to browse sample Javadoc for MJ classes and tools, including the MJ Runtime Library.

 

Package: com.arsi.mj.maprpt.parser.pragma  previous next contents

Package com.arsi.mj.maprpt.parser.pragma contains the following classes and interfaces.
Classes and Interfaces
Pragma Abstract base class for all "pragma" directives that may occur in a Mapper report that is to be converted by MJ.
PragmaNames Defines names of all pragmas, and commonly used pragma argument names.

Class: Pragma   next package

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.

public abstract class com.arsi.mj.maprpt.parser.pragma.Pragma
  extends java.lang.Object
Fields
Does this pragma stand alone on a line by itself?
protected final boolean isStandalone
Arguments included in pragma directive, if any (may be an empty map).
protected final java.util.Map mapArguments
Name of pragma as embedded in the Mapper report, should be unique among all pragmas.
protected final java.lang.String name
Constructors
Restricted ctor for initializing an instance of this class.
Parameters:
aName - name of pragma.
someArguments - arguments included in pragma directive, if any (may be an empty map).
aStandaloneFlag - does pragma occur on a line by itself?
protected Pragma(java.lang.String aName, java.util.Map someArguments, boolean aStandaloneFlag)
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

Class: PragmaNames   previous package

Defines names of all pragmas, and commonly used pragma argument names.
public final class com.arsi.mj.maprpt.parser.pragma.PragmaNames
  extends java.lang.Object
Fields
public static final java.lang.String APPLY_TO_ARG = "applyTo"
public static final java.lang.String ASSERT_DATA_TUPLE = "assert-data-tuple"
public static final java.lang.String DEFAULT_COLUMN_NAMES = "default-column-names"
public static final java.lang.String EXPECTED_LINE_TYPE_ARG = "expectedLineType"
public static final java.lang.String IGNORE_COLUMN_HEADING = "ignore-column-hdgs"
public static final java.lang.String IGNORE_DATA_TUPLE = "ignore-data-tuple"
public static final java.lang.String IGNORE_RUN_LINE = "ignore-run-line"
public static final java.lang.String NUM_AFFECTED_LINES_ARG = "numberOfLines"
public static final java.lang.String USE_INLINE_DATA_HANDLER = "use-inline-data-handler"
Constructors
public PragmaNames()