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

 

Package: com.arsi.mj.text  previous next contents

The text package contains a number of formatting and parsing utilities used to work with Mapper variables and constructs. In general, these utilities should always be used via static reference if one is available.

Date and Time Patterns

Date and time formats are specified by date and time pattern implementations. These implementations correspond to Mapper format patterns.

Date and time formats keep date and time data separate, but allow coercion from one form to the other. The date/time formats also allow input of integral and floating-point numbers.

The date and time formats handle date-time and numeric input consistently for the bulk of the implementations; exceptions are noted and detailed below the charts. All dates must be in the ranges defined below for their formats.

Classes and Interfaces
CustomDateTimeFormat Custom date format base class for all single-digit year date formats; needed since FastDateFormat (like JDK7) returns two digits for "Y".
FormatOption Enumeration instances are used to perform custom formatting.
FormatOptionType Defines the classification types of formats supported by MJFormatter.
ICoercedInteger Defines a mechanism for reporting coerced integer length.
IFormattedDate Defines Mapper-compatible formatting for dates, including SimpleDateFormat patterns for Mapper date and time formats.
IFormattedNumber Defines Mapper-compatible formatting for numbers.
IFormattedString Defines Mapper-compatible text formatting.
IFormattedVariable Defines Mapper-compatible formatting options common to all data types.
MJFormatter Performs Mapper-compatible formatting of variables.

Class: CustomDateTimeFormat   next package

Custom date format base class for all single-digit year date formats; needed since FastDateFormat (like JDK7) returns two digits for "Y".

Treat this class as "thread-safe" (actually it relies on the thread safety of FastDateFormat).
public abstract class com.arsi.mj.text.CustomDateTimeFormat
  extends org.apache.commons.lang3.time.FastDateFormat
Constructors
Ctor for initializing an instance of this class.
Parameters:
aPattern - the pattern to use for formatting
aFormat - the format for content display
protected CustomDateTimeFormat(java.lang.String aPattern, com.arsi.mj.text.FormatOption aFormat)
Methods
Obtains the output format/style.
Returns:
the contentFormat
public com.arsi.mj.text.FormatOption getContentFormat()

Class: FormatOption   previous next package

Enumeration instances are used to perform custom formatting. Treat this class as "thread-compatible", since the state held by an instance is internal to an invocation of any method; there is no need for external synchronization, as the instances have no state.
public class com.arsi.mj.text.FormatOption
  extends java.lang.Enum
Fields
Performs the formatting described by IFormattedString#lowerCase.
public static final com.arsi.mj.text.FormatOption CASE_LOWER
Performs the formatting described by IFormattedString#upperCase.
public static final com.arsi.mj.text.FormatOption CASE_UPPER
Performs the formatting described by IFormattedString#center.
public static final com.arsi.mj.text.FormatOption CENTER
Performs the formatting described by IFormattedNumber#commas.
public static final com.arsi.mj.text.FormatOption COMMAS
Performs the formatting described by IFormattedString#leftJustifyBlankFill.
public static final com.arsi.mj.text.FormatOption LEFT_JUSTIFY_BLANK_FILL
Performs the implicit left justification used by string (A-type, S-type, H-type) variables by default (does not strip leading whitespace).
public static final com.arsi.mj.text.FormatOption LEFT_JUSTIFY_IMPLICIT
Performs the formatting described by IFormattedNumber#leftJustifyTruncateZeros.
public static final com.arsi.mj.text.FormatOption LEFT_JUSTIFY_TRUNCATE_ZEROS
Performs the formatting described by IFormattedNumber#leftJustifyZeroFill.
public static final com.arsi.mj.text.FormatOption LEFT_JUSTIFY_ZERO_FILL
Performs the formatting described by IFormattedNumber#noCommas.
public static final com.arsi.mj.text.FormatOption NO_COMMAS
The classification of the format option.
public final com.arsi.mj.text.FormatOptionType optionType
Performs the formatting described by IFormattedVariable#pack.
public static final com.arsi.mj.text.FormatOption PACK
Performs the formatting described by IFormattedString#rightJustifyBlankFill.
public static final com.arsi.mj.text.FormatOption RIGHT_JUSTIFY_BLANK_FILL
Performs the formatting described by IFormattedString#rightJustifyTrimBlanks.
public static final com.arsi.mj.text.FormatOption RIGHT_JUSTIFY_TRIM_BLANKS
Performs the formatting described by IFormattedNumber#rightJustifyTrimZerosBlankFill.
public static final com.arsi.mj.text.FormatOption RIGHT_JUSTIFY_TRIM_ZEROS_BLANK_FILL
Performs the formatting described by IFormattedNumber#rightJustifyTrimZerosBlanks.
public static final com.arsi.mj.text.FormatOption RIGHT_JUSTIFY_TRIM_ZEROS_BLANKS
Performs the formatting described by IFormattedNumber#rightJustifyZeroFillKeep.
public static final com.arsi.mj.text.FormatOption RIGHT_JUSTIFY_ZERO_FILL_KEEP
Performs the formatting described by IFormattedNumber#rightJustifyZeroFillTrimmed.
public static final com.arsi.mj.text.FormatOption RIGHT_JUSTIFY_ZERO_FILL_TRIMMED
Performs the formatting described by IFormattedString#rightJustifyZeroPad.
public static final com.arsi.mj.text.FormatOption RIGHT_JUSTIFY_ZERO_PAD
Performs the formatting described by IFormattedString#rightJustifyZeroReformat.
public static final com.arsi.mj.text.FormatOption RIGHT_JUSTIFY_ZERO_REFORMAT
Methods
Generates content according to the implemented formatting rules, based on the input content and formatting constraints provided. Some implementations will not apply any formatting if the result would cause a display overflow.
Parameters:
someContent - the content as it has been formatted so far
anOutputLength - the maximum output length allowed
anOverflowLimit - the length at which a display overflow would occur
aContentClass - class (for example, Long, BigDecimal or String) of value being formatted.
Returns:
the appropriately-formatted content
public abstract java.lang.String applyFormat(java.lang.String someContent, int anOutputLength, int anOverflowLimit, java.lang.Class aContentClass)

Provides a mechanism to ensure the grouping of formatting options is always consistent with the well-defined series of precedence rules.

  1. If the provided option is of type OVERRIDE, it replaces all current options except for packing
  2. If the provided option is of type ALIGNMENT, it replaces all specified options of the same type
  3. If the provided option is of type CASE, it replaces all specified options of the same type
  4. If the provided option is of type PACK, it is only added if there are no options of that type in the current collection
Parameters:
aCurrentOptionSet - the options to be managed
aNewOption - the option to add to the group
Returns:
the updated grouping
See Also:
FormatOptionType
public static java.util.Set updateOptions(java.util.Set aCurrentOptionSet, com.arsi.mj.text.FormatOption aNewOption)
public static com.arsi.mj.text.FormatOption valueOf(java.lang.String name)
public static com.arsi.mj.text.FormatOption values()

Class: FormatOptionType   previous next package

Defines the classification types of formats supported by MJFormatter. These classifications are used to manage the currently active format options selected.
public final class com.arsi.mj.text.FormatOptionType
  extends java.lang.Enum
Fields
Indicates that a format option manages the alignment of the value's content. Only one format of this type can be active at any given time.
public static final com.arsi.mj.text.FormatOptionType ALIGNMENT
Indicates that a format option manages the character case of the value's content. Only one format of this type can be active at any given time.
public static final com.arsi.mj.text.FormatOptionType CASE
Indicates that a format option should override any options that are currently set (except those of type PACK); there is no impact to options that are set afterwards.
public static final com.arsi.mj.text.FormatOptionType OVERRIDE
Indicates that a format option manages packing. Only one format of this type can be active at any given time.
public static final com.arsi.mj.text.FormatOptionType PACK
Methods
public static com.arsi.mj.text.FormatOptionType valueOf(java.lang.String name)
public static com.arsi.mj.text.FormatOptionType values()

Interface: ICoercedInteger   previous next package

Defines a mechanism for reporting coerced integer length.
public interface com.arsi.mj.text.ICoercedInteger
Methods
Get the coerced integer length of a numeric variable.
Returns:
coerced integer length, or -1 if not applicable.
public int coercedIntegerLength()

Interface: IFormattedDate   previous next package

Defines Mapper-compatible formatting for dates, including SimpleDateFormat patterns for Mapper date and time formats.
public interface com.arsi.mj.text.IFormattedDate
  extends com.arsi.mj.text.IFormattedVariable
Fields
SimpleDateFormat-compatible instance for Mapper DATE0 format (and @DAT format A).
public static final org.apache.commons.lang3.time.FastDateFormat DATE0_YMMDD
SimpleDateFormat-compatible instance for Mapper DATE11 format (and @DAT format L).
public static final org.apache.commons.lang3.time.FastDateFormat DATE11_YYYYMMDD
SimpleDateFormat-compatible instance for Mapper DATE12 format (and @DAT format M).
public static final org.apache.commons.lang3.time.FastDateFormat DATE12_DD_MMM_YYYY
SimpleDateFormat-compatible instance for Mapper DATE14 format (and @DAT format O).
public static final org.apache.commons.lang3.time.FastDateFormat DATE14_YYYYDDD
SimpleDateFormat-compatible instance for Mapper DATE15 format (and @DAT format P).
public static final org.apache.commons.lang3.time.FastDateFormat DATE15_DDMMYYYY
SimpleDateFormat-compatible instance for Mapper DATE16 format (and @DAT format Q).
public static final org.apache.commons.lang3.time.FastDateFormat DATE16_MM_DD_YYYY
SimpleDateFormat-compatible instance for Mapper DATE18 format (and @DAT format S).
public static final org.apache.commons.lang3.time.FastDateFormat DATE18_MMDDYYYY
SimpleDateFormat-compatible instance for Mapper DATE19 format (and @DAT format T).
public static final org.apache.commons.lang3.time.FastDateFormat DATE19_DD_MM_YYYY
SimpleDateFormat-compatible instance for Mapper DATE1 format (and @DAT format B).
public static final org.apache.commons.lang3.time.FastDateFormat DATE1_YYMMDD
SimpleDateFormat-compatible instance for Mapper DATE20 format (and @DAT format U).
public static final org.apache.commons.lang3.time.FastDateFormat DATE20_YYYY_MM_DD
SimpleDateFormat-compatible instance for Mapper DATE2 format (and @DAT format C).
public static final org.apache.commons.lang3.time.FastDateFormat DATE2_DD_MMM_YY
SimpleDateFormat-compatible instance for Mapper DATE3 format (and @DAT format D).
public static final org.apache.commons.lang3.time.FastDateFormat DATE3_YDDD
SimpleDateFormat-compatible instance for Mapper DATE4 format (and @DAT format E).
public static final org.apache.commons.lang3.time.FastDateFormat DATE4_YYDDD
SimpleDateFormat-compatible instance for Mapper DATE5 format (and @DAT format F).
public static final org.apache.commons.lang3.time.FastDateFormat DATE5_DDMMYY
SimpleDateFormat-compatible instance for Mapper DATE6 format (and @DAT format G).
public static final org.apache.commons.lang3.time.FastDateFormat DATE6_MM_DD_YY
SimpleDateFormat-compatible instance for Mapper DATE7 format (and @DAT format H).
public static final org.apache.commons.lang3.time.FastDateFormat DATE7_MONTH_DD_YYYY
SimpleDateFormat-compatible instance for Mapper DATE8 format (and @DAT format I).
public static final org.apache.commons.lang3.time.FastDateFormat DATE8_MMDDYY
SimpleDateFormat-compatible instance for Mapper DATE9 format (and @DAT format J).
public static final org.apache.commons.lang3.time.FastDateFormat DATE9_DD_MM_YY
SimpleDateFormat-compatible instance for Mapper DATEC format.
public static final org.apache.commons.lang3.time.FastDateFormat DATEC_MONTH_NAME
SimpleDateFormat-compatible instance for Mapper DATED format.
public static final org.apache.commons.lang3.time.FastDateFormat DATED_DAY
SimpleDateFormat-compatible instance for Mapper DATEJ format.
public static final org.apache.commons.lang3.time.FastDateFormat DATEJ_JULIAN_DAY
SimpleDateFormat-compatible instance for Mapper DATEM format.
public static final org.apache.commons.lang3.time.FastDateFormat DATEM_MONTH
SimpleDateFormat-compatible instance for Mapper DATEN format.
public static final org.apache.commons.lang3.time.FastDateFormat DATEN_WEEKDAY_NUMBER
SimpleDateFormat-compatible instance for Mapper DATEW format.
public static final org.apache.commons.lang3.time.FastDateFormat DATEW_WEEKDAY
SimpleDateFormat-compatible instance for Mapper DATEY format.
public static final org.apache.commons.lang3.time.FastDateFormat DATEY_YY
SimpleDateFormat-compatible instance for Mapper DATEZ format.
public static final org.apache.commons.lang3.time.FastDateFormat DATEZ_YYYY
SimpleDateFormat-compatible instance for Mapper TIME0 format.
public static final org.apache.commons.lang3.time.FastDateFormat TIME0_HH_MM_SS
SimpleDateFormat-compatible instance for Mapper TIME1 format.
public static final org.apache.commons.lang3.time.FastDateFormat TIME1_HH_MM
SimpleDateFormat-compatible instance for Mapper TIME2 format.
public static final org.apache.commons.lang3.time.FastDateFormat TIME2_HHMMSS
SimpleDateFormat-compatible instance for Mapper TIME3 format.
public static final org.apache.commons.lang3.time.FastDateFormat TIME3_HHMM
SimpleDateFormat-compatible instance for Mapper TIME4 format.
public static final org.apache.commons.lang3.time.FastDateFormat TIME4_HHHHHHH_MM_SS
SimpleDateFormat-compatible instance for Mapper TIME5 format.
public static final org.apache.commons.lang3.time.FastDateFormat TIME5_HHHHHHH_MM
SimpleDateFormat-compatible instance for Mapper TIMEH format.
public static final org.apache.commons.lang3.time.FastDateFormat TIMEH_HOUR
SimpleDateFormat-compatible instance for Mapper TIMEM format.
public static final org.apache.commons.lang3.time.FastDateFormat TIMEM_MINUTE
SimpleDateFormat-compatible instance for Mapper TIMES format.
public static final org.apache.commons.lang3.time.FastDateFormat TIMES_SECOND
Methods
Set date format to use to produce formatted date for output.
Parameters:
aFormat - a fast date format.
Returns:
this formatted date.
public com.arsi.mj.text.IFormattedDate dateFormat(org.apache.commons.lang3.time.FastDateFormat aFormat)

Interface: IFormattedNumber   previous next package

Defines Mapper-compatible formatting for numbers.
public interface com.arsi.mj.text.IFormattedNumber
  extends com.arsi.mj.text.IFormattedVariable
Methods

Inserts commas in integer portion of number every third digit, eliminates leading zeros, right-justifies the contents, and blank fills all remaining characters to left of number. If inserting commas would expand the length beyond the maximum size allowed, no formatting is applied.

Similar to the C option of the JUV command.
Returns:
this formatted number.
public com.arsi.mj.text.IFormattedNumber commas()

Inserts thousands separator for locale in integer portion of number every third digit, eliminates leading zeros, right-justifies the contents, and blank fills all remaining characters to left of number. Also uses decimal separator for locale to separate integer and decimal portions of number. If inserting thousands separators would expand the length beyond the maximum size allowed, no formatting is applied.

Similar to the CE option of the JUV command.
Parameters:
aLocale - locale that specifies decimal formatting symbols.
Returns:
this formatted number.
public com.arsi.mj.text.IFormattedNumber commas(java.util.Locale aLocale)

Switches between U.S. and European numeric notation (periods are changed to commas, and commas are changed to periods).

Similar to the E option of the JUV command.
Returns:
this formatted number.
public com.arsi.mj.text.IFormattedNumber flipThousandSeparators()

Eliminates leading and trailing zeros, left-justifies the contents, and blank fills all remaining characters to the right of the number.

Similar to the L option of the JUV command.
Returns:
this formatted number.
public com.arsi.mj.text.IFormattedNumber leftJustifyTruncateZeros()

Eliminates leading zeros, left-justifies the contents, and zero-fills all remaining characters to the right of the number.

Similar to the X option of the JUV command.
Returns:
this formatted number.
public com.arsi.mj.text.IFormattedNumber leftJustifyZeroFill()

Clears all commas and leading zeros, and right-justifies the contents.

Similar to the D option of the JUV command.
Returns:
this formatted number.
public com.arsi.mj.text.IFormattedNumber noCommas()

Clears thousands separator for locale and leading zeros, and right-justifies the contents. Also reverts from decimal separator to a period.

Similar to the DE option of the JUV command.
Parameters:
aLocale - locale that specifies decimal formatting symbols to clear.
Returns:
this formatted number.
public com.arsi.mj.text.IFormattedNumber noCommas(java.util.Locale aLocale)

Eliminates leading and insignificant trailing zeros, eliminates leading (but not trailing) spaces, right-justifies the contents, and blank fills all remaining characters to the left of the number.

Similar to the R option of the JUV command as applied to variables padded with trailing spaces by setSubstring.
Returns:
this formatted number.
public com.arsi.mj.text.IFormattedNumber rightJustifyTrimZerosBlankFill()

Eliminates leading and insignificant trailing zeros, eliminates leading and trailing spaces, right-justifies the contents, and blank fills all remaining characters to the left of the number.

Similar to the R option of the JUV command in most cases.
Returns:
this formatted number.
public com.arsi.mj.text.IFormattedNumber rightJustifyTrimZerosBlanks()

Eliminates insignificant trailing zeros, eliminates leading but keeps trailing spaces, right-justifies the contents, and zero-fills all remaining characters to the left of the number.

Similar to the Z option of the JUV command as applied to variables padded with trailing spaces by setSubstring.
Returns:
this formatted number.
public com.arsi.mj.text.IFormattedNumber rightJustifyZeroFillKeep()

Eliminates insignificant trailing zeros, eliminates leading and trailing spaces, right-justifies the contents, and zero-fills all remaining characters to the left of the number.

Similar to the Z option of the JUV command in most cases.
Returns:
this formatted number.
public com.arsi.mj.text.IFormattedNumber rightJustifyZeroFillTrimmed()

Interface: IFormattedString   previous next package

Defines Mapper-compatible text formatting.
public interface com.arsi.mj.text.IFormattedString
  extends com.arsi.mj.text.IFormattedVariable
Methods

Centers data within the size of the variable. If there are an odd number of spaces to split, the extra space always precedes the non-space content.

Similar to the C option of the LDV command.
Returns:
this formatted string.
public com.arsi.mj.text.IFormattedString center()

Left-justifies the data within the size of the variable, padding on the right with spaces.

Similar to the L option of the LDV command.
Returns:
this formatted string.
public com.arsi.mj.text.IFormattedString leftJustifyBlankFill()

Converts all upper-case alphabetic characters to lower-case characters.

Similar to the O option of the LDV command.
Returns:
this formatted string.
public com.arsi.mj.text.IFormattedString lowerCase()

Right-justifies the data within the size of the variable (after trimming leading spaces, but keeping trailing spaces), padding on the left with spaces.

Similar to the R option of the LDV command as applied to variables padded with trailing spaces by setSubstring.
Returns:
this formatted string.
public com.arsi.mj.text.IFormattedString rightJustifyBlankFill()

Right-justifies the data within the size of the variable (after trimming leading and trailing spaces), padding on the left with spaces.

Similar to the R option of the LDV command in most cases.
Returns:
this formatted string.
public com.arsi.mj.text.IFormattedString rightJustifyTrimBlanks()

Right-justifies the data within the size of the variable, padding on the left with zeros. If the first non-space character is "+" or "-", this becomes the first character in the variable content, and padding zeros are added after it up to the first non-alphanumeric character. Any spaces the between the first non-alphanumeric character and the first alphanumeric character are left as is, and count toward the total length.

Similar to the Z option of the LDV command.
Returns:
this formatted string.
public com.arsi.mj.text.IFormattedString rightJustifyZeroPad()

Right-justifies the data within the size of the variable, padding on the left with zeros. The content of the variable has no impact on the formatting.

Similar to the Z option used to temporarily reformat the contents of a variable for individual Mapper statements or in the Mapper output area (e.g., <data1>(z))
Returns:
this formatted string.
public com.arsi.mj.text.IFormattedString rightJustifyZeroReformat()

Converts all lower-case alphabetic characters to upper-case characters.

Similar to the U option of the LDV command.
Returns:
this formatted string.
public com.arsi.mj.text.IFormattedString upperCase()

Interface: IFormattedVariable   previous next package

Defines Mapper-compatible formatting options common to all data types.
public interface com.arsi.mj.text.IFormattedVariable
Methods
Determines if the value to format represents a valid value; if not, special formatting for invalid values (e.g., asterisks) is applied. An invalid value is distinct and different from a NULL or default value.
Returns:
true if value to format represents a valid value, false if value is invalid.
public boolean isValid()
Set output length of variable value, formatted value of variable should be this many characters in length, unless overridden by packing and overflow length.
Parameters:
aLength - output length of variable value.
Returns:
this formatted variable.
public com.arsi.mj.text.IFormattedVariable outputLength(int aLength)
Set output scale (number of digits to the right of decimal point) of variable value; formatted value of numeric variable should attempt to display this many digits after the decimal point. Display of significant digits (digits to left of decimal point) takes precedence over fractional digits, and upwards rounding may occurs if the value of the variable has more fractional digits that the output scale can display.
Parameters:
aScale - output scale of variable value.
Returns:
this formatted variable.
public com.arsi.mj.text.IFormattedVariable outputScale(int aScale)

Packs data to contain only significant characters, trimming unnecessary leading and trailing spaces. No overflow behavior occurs with this method, as the packed length is based on the current formatted length of the variable.

Similar to the P option in the Mapper output area.
Returns:
this formatted variable.
public com.arsi.mj.text.IFormattedVariable pack()

Packs data to contain only significant characters, trimming unnecessary leading and trailing spaces. Packing also triggers overflow behavior where the length of the packed value becomes the overflow-on-output-length. The overflow character is an asterisk by default, and is substituted for the content unless truncation is applied instead.

Similar to the P option of the LDV command.
Parameters:
aPackedLength - if length of variable, when formatted as a string, exceeds this length, the variable is output as overflow characters. If a negative value is provided, packing is disabled.
Returns:
this formatted variable.
public com.arsi.mj.text.IFormattedVariable pack(int aPackedLength)
Set indicator that value to format represents a valid value.
Parameters:
aValidFlag - true if value to format represents a valid value, false if value is invalid.
public void setValid(boolean aValidFlag)
Apply formatting to value of variable and return as string. Use toString to get the canonical value of a variable as a string without formatting.
Returns:
formatted value of variable.
public java.lang.String toFormatted()

Class: MJFormatter   previous package

Performs Mapper-compatible formatting of variables.

Treat this class as "thread-compatible", since the state held by an instance is mutable but without synchronization; an instance should not be accessed or modified by more than one thread simultaneously without external synchronization.
public class com.arsi.mj.text.MJFormatter
  extends java.lang.Object
  implements com.arsi.mj.text.IFormattedVariable, com.arsi.mj.text.IFormattedString, com.arsi.mj.text.IFormattedNumber, com.arsi.mj.text.IFormattedDate
Fields
Regular expression (see value) used to check for numeric values; Mapper does not typically treat values with commas or exponential notation as numeric.
public static final java.lang.String PATTERN_NUMERIC = "[+-]?(\\d+|\\.\\d+|\\d+\\.\\d+)"
Constructors
Public ctor for initializing an immutable instance of this class from a decimal.
Parameters:
aDecimal - decimal value to format, may be null.
public MJFormatter(java.math.BigDecimal aDecimal)
Public ctor for initializing an immutable instance of this class from a date.
Parameters:
aCalendar - calendar value to format, may be null.
public MJFormatter(java.util.Calendar aCalendar)
Public ctor for initializing an instance of this class with a formatting class type.
Parameters:
aDefaultFormattingClass - object type to use in formatting.
Throws:
IllegalArgumentException - if the class type is not supported
public MJFormatter(java.lang.Class aDefaultFormattingClass)
Public ctor for initializing an immutable instance of this class from a date.
Parameters:
aDate - date value to format, may be null.
public MJFormatter(java.util.Date aDate)
Public ctor for initializing an immutable instance of this class from a double.
Parameters:
aDouble - scalar double value to format.
public MJFormatter(double aDouble)
Public ctor for initializing an immutable instance of this class from a double.
Parameters:
aDouble - double value to format, may be null.
public MJFormatter(java.lang.Double aDouble)
Public ctor for initializing an immutable instance of this class from a float.
Parameters:
aFloat - scalar float value to format.
public MJFormatter(float aFloat)
Public ctor for initializing an immutable instance of this class from a float.
Parameters:
aFloat - float value to format, may be null.
public MJFormatter(java.lang.Float aFloat)
Public ctor for initializing an immutable instance of this class from an integer.
Parameters:
anInt - scalar integer value to format.
public MJFormatter(int anInt)
Public ctor for initializing an immutable instance of this class from an integer.
Parameters:
anInt - integer value to format, may be null.
public MJFormatter(java.lang.Integer anInt)
Public ctor for initializing an immutable instance of this class from a long.
Parameters:
aLong - scalar long value to format.
public MJFormatter(long aLong)
Public ctor for initializing an immutable instance of this class from a long.
Parameters:
aLong - long value to format, may be null.
public MJFormatter(java.lang.Long aLong)
Public ctor for initializing an immutable instance of this class from an MJ decimal variable.
Parameters:
aDecimal - MJ decimal variable to format.
public MJFormatter(com.arsi.mj.variable.MJDecimal aDecvar)
Public ctor for initializing an immutable instance of this class from an MJ integer variable.
Parameters:
anIntvar - MJ integer variable to format.
public MJFormatter(com.arsi.mj.variable.MJInteger anIntvar)
Public ctor for initializing an immutable instance of this class from an MJ string variable.
Parameters:
aStrvar - MJ string variable to format.
public MJFormatter(com.arsi.mj.variable.MJString aStrvar)
Public ctor for initializing an immutable instance of this class from a string.
Parameters:
aString - string value to format, may be null.
public MJFormatter(java.lang.String aString)
Methods
public com.arsi.mj.text.IFormattedString center()
Clear indicator that this instance is to be treated as immutable.
public void clearImmutable()
Clear variable value held by formatter; default formatting semantics apply when variable is cleared.
See Also:
useDefault
public void clearValue()
public com.arsi.mj.text.IFormattedNumber commas()
Throws exception; not currently implemented.
See Also:
com.arsi.mj.text.IFormattedNumber#commas(java.util.Locale)
public com.arsi.mj.text.IFormattedNumber commas(java.util.Locale aLocale)
public com.arsi.mj.text.IFormattedDate dateFormat(org.apache.commons.lang3.time.FastDateFormat aFormat)
Throws exception; not currently implemented.
See Also:
com.arsi.mj.text.IFormattedNumber#flipThousandSeparators()
public com.arsi.mj.text.IFormattedNumber flipThousandSeparators()
Get class used for default formatting.
Returns:
class of Long, Double, BigDecimal, String or Calendar.
public java.lang.Class getClassForDefaultFormatting()
Obtains the current formatting options that will be applied. The implementation preserves the order in which the formats were applied.
Returns:
the current options
public java.util.Set getFormattingOptions()
Get value-to-format.
Returns:
value to format (Long, Double, BigDecimal, String or Calendar) or NULL if none (e.g., was cleared).
public java.lang.Object getValue()
Determines if the value to format represents a valid value; if not, special formatting for invalid values (e.g., asterisks) is applied. An invalid value is distinct and different from a NULL value.
Returns:
true if value to format represents a valid value, false if value is invalid.
public boolean isValid()
public com.arsi.mj.text.IFormattedString leftJustifyBlankFill()
public com.arsi.mj.text.IFormattedNumber leftJustifyTruncateZeros()
public com.arsi.mj.text.IFormattedNumber leftJustifyZeroFill()
public com.arsi.mj.text.IFormattedString lowerCase()
public com.arsi.mj.text.IFormattedNumber noCommas()
Throws exception; not currently implemented.
See Also:
com.arsi.mj.text.IFormattedNumber#noCommas(java.util.Locale)
public com.arsi.mj.text.IFormattedNumber noCommas(java.util.Locale aLocale)
public com.arsi.mj.text.IFormattedVariable outputLength(int aLength)
public com.arsi.mj.text.IFormattedVariable outputScale(int aScale)
public com.arsi.mj.text.IFormattedVariable pack()
public com.arsi.mj.text.IFormattedVariable pack(int aPackedLength)
public com.arsi.mj.text.IFormattedString rightJustifyBlankFill()
public com.arsi.mj.text.IFormattedString rightJustifyTrimBlanks()
public com.arsi.mj.text.IFormattedNumber rightJustifyTrimZerosBlankFill()
public com.arsi.mj.text.IFormattedNumber rightJustifyTrimZerosBlanks()
public com.arsi.mj.text.IFormattedNumber rightJustifyZeroFillKeep()
public com.arsi.mj.text.IFormattedNumber rightJustifyZeroFillTrimmed()
public com.arsi.mj.text.IFormattedString rightJustifyZeroPad()
public com.arsi.mj.text.IFormattedString rightJustifyZeroReformat()
Establish mechanism for obtaining coerced integer length.
Parameters:
aCoercedInteger - implementation of interface that returns coerced integer length, NULL if not applicable.
public void setCoercedInteger(com.arsi.mj.text.ICoercedInteger aCoercedInteger)
Set indicator whether value to format represents a valid value.
Parameters:
aValidFlag - true if value to format represents a valid value, false if value is invalid.
public void setValid(boolean aValidFlag)
Set value-to-format to a decimal.
Parameters:
aDecimal - decimal value to format, may be null.
public void setValue(java.math.BigDecimal aDecimal)
Set value-to-format to a calendar date.
Parameters:
aCalendar - calendar date value to format, may be null.
public void setValue(java.util.Calendar aCalendar)
Set value-to-format to a date.
Parameters:
aDate - date value to format, may be null.
public void setValue(java.util.Date aDate)
Set value-to-format to a double.
Parameters:
aDouble - scalar double value to format.
public void setValue(double aDouble)
Set value-to-format to a double.
Parameters:
aDouble - double value to format, may be null.
public void setValue(java.lang.Double aDouble)
Set value-to-format to a float.
Parameters:
aFloat - scalar float value to format.
public void setValue(float aFloat)
Set value-to-format to a float.
Parameters:
aFloat - float value to format, may be null.
public void setValue(java.lang.Float aFloat)
Set value-to-format to an integer.
Parameters:
anInt - scalar integer value to format.
public void setValue(int anInt)
Set value-to-format to an integer.
Parameters:
anInt - integer value to format, may be null.
public void setValue(java.lang.Integer anInt)
Set value-to-format to a long.
Parameters:
aLong - scalar long value to format.
public void setValue(long aLong)
Set value-to-format to a long.
Parameters:
aLong - long value to format, may be null.
public void setValue(java.lang.Long aLong)
Set value-to-format to a string.
Parameters:
aString - string value to format, may be null.
public void setValue(java.lang.String aString)
public java.lang.String toFormatted()
Set slice of variable value, treated as a string, to use as input to formatting options. The numeric inputs cannot both be zero.
Parameters:
aString - the content to operate on.
aPosition - position in string value of variable where slice starts (counting from one), or zero to specify end of variable.
aLength - length of slice, i.e., number of characters extracted from string value of variable starting at aPosition, zero to extract all remaining characters in variable.
Throws:
IndexOutOfBoundsException - if the position or length provided cannot be applied to the provided content (position and length both zero, specified slice outside of string bounds)
Returns:
this extracted value.
public static java.lang.String toSlice(java.lang.String aString, int aPosition, int aLength)
public com.arsi.mj.text.IFormattedString upperCase()
Clear formatting directives and set to use default formatting; does not affect variable value held by formatter.
public void useDefault()