Package com.solab.iso8583
Enum IsoType
- java.lang.Object
-
- java.lang.Enum<IsoType>
-
- com.solab.iso8583.IsoType
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Comparable<IsoType>
public enum IsoType extends java.lang.Enum<IsoType>
Defines the possible values types that can be used in the fields. Some types required the length of the value to be specified (NUMERIC and ALPHA). Other types have a fixed length, like dates and times. Other types do not require a length to be specified, like LLVAR and LLLVAR.
-
-
Enum Constant Summary
Enum Constants Enum Constant Description ALPHA
A fixed-length alphanumeric value.AMOUNT
An amount, expressed in cents with a fixed length of 12.BINARY
Similar to ALPHA but holds byte arrays instead of strings.DATE_EXP
A date in format yyMMDATE10
A date in format MMddHHmmssDATE12
Date in format yyMMddHHmmss.DATE14
A date in format YYYYMMddHHmmssDATE4
A date in format MMddDATE6
Date in format yyMMddLLBCDBIN
Similar to LLBIN but with a BCD encoded length.LLBIN
Similar to LLVAR but holds byte arrays instead of strings.LLLBCDBIN
Similar to LLLBIN but with a BCD encoded length.LLLBIN
Similar to LLLVAR but holds byte arrays instead of strings.LLLLBCDBIN
Similar to LLLLBIN but with a BCD encoded length.LLLLBIN
variable length byte array with 4-digit header length.LLLLVAR
variable length with 4-digit header length.LLLVAR
A variable length alphanumeric value with a 3-digit header length.LLVAR
A variable length alphanumeric value with a 2-digit header length.NUMERIC
A fixed-length numeric value.TIME
Time of day in format HHmmss
-
Field Summary
Fields Modifier and Type Field Description static java.util.Set<IsoType>
VARIABLE_LENGTH_BIN_TYPES
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> IsoValue<T>
apply(T val)
<T> IsoValue<T>
apply(T val, int len)
<T> IsoValue<T>
call(T val)
<T> IsoValue<T>
call(T val, int len)
java.lang.String
format(long value, int length)
Formats the integer value as a NUMERIC, an AMOUNT, or a String.java.lang.String
format(java.lang.String value, int length)
Formats the string to the given length (length is only useful if type is ALPHA, NUMERIC or BINARY).java.lang.String
format(java.math.BigDecimal value, int length)
Formats the BigDecimal as an AMOUNT, NUMERIC, or a String.java.lang.String
format(java.util.Date value, java.util.TimeZone tz)
Formats a Date if the receiver is DATE10, DATE4, DATE_EXP, DATE12, DATE14 or TIME; throws an exception otherwise.int
getLength()
Returns the length of the type if it's always fixed, or 0 if it's variable.boolean
needsLength()
Returns true if the type needs a specified length.<T> IsoValue<T>
value(T val)
<T> IsoValue<T>
value(T val, int len)
static IsoType
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.static IsoType[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
NUMERIC
public static final IsoType NUMERIC
A fixed-length numeric value. It is zero-filled to the left.
-
ALPHA
public static final IsoType ALPHA
A fixed-length alphanumeric value. It is filled with spaces to the right.
-
LLVAR
public static final IsoType LLVAR
A variable length alphanumeric value with a 2-digit header length.
-
LLLVAR
public static final IsoType LLLVAR
A variable length alphanumeric value with a 3-digit header length.
-
DATE14
public static final IsoType DATE14
A date in format YYYYMMddHHmmss
-
DATE10
public static final IsoType DATE10
A date in format MMddHHmmss
-
DATE4
public static final IsoType DATE4
A date in format MMdd
-
DATE_EXP
public static final IsoType DATE_EXP
A date in format yyMM
-
TIME
public static final IsoType TIME
Time of day in format HHmmss
-
AMOUNT
public static final IsoType AMOUNT
An amount, expressed in cents with a fixed length of 12.
-
BINARY
public static final IsoType BINARY
Similar to ALPHA but holds byte arrays instead of strings.
-
LLBIN
public static final IsoType LLBIN
Similar to LLVAR but holds byte arrays instead of strings.
-
LLLBIN
public static final IsoType LLLBIN
Similar to LLLVAR but holds byte arrays instead of strings.
-
LLLLVAR
public static final IsoType LLLLVAR
variable length with 4-digit header length.
-
LLLLBIN
public static final IsoType LLLLBIN
variable length byte array with 4-digit header length.
-
LLBCDBIN
public static final IsoType LLBCDBIN
Similar to LLBIN but with a BCD encoded length.
-
LLLBCDBIN
public static final IsoType LLLBCDBIN
Similar to LLLBIN but with a BCD encoded length.
-
LLLLBCDBIN
public static final IsoType LLLLBCDBIN
Similar to LLLLBIN but with a BCD encoded length.
-
DATE12
public static final IsoType DATE12
Date in format yyMMddHHmmss.
-
DATE6
public static final IsoType DATE6
Date in format yyMMdd
-
-
Field Detail
-
VARIABLE_LENGTH_BIN_TYPES
public static final java.util.Set<IsoType> VARIABLE_LENGTH_BIN_TYPES
-
-
Method Detail
-
values
public static IsoType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (IsoType c : IsoType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static IsoType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null
-
needsLength
public boolean needsLength()
Returns true if the type needs a specified length.
-
getLength
public int getLength()
Returns the length of the type if it's always fixed, or 0 if it's variable.
-
format
public java.lang.String format(java.util.Date value, java.util.TimeZone tz)
Formats a Date if the receiver is DATE10, DATE4, DATE_EXP, DATE12, DATE14 or TIME; throws an exception otherwise.
-
format
public java.lang.String format(java.lang.String value, int length)
Formats the string to the given length (length is only useful if type is ALPHA, NUMERIC or BINARY).
-
format
public java.lang.String format(long value, int length)
Formats the integer value as a NUMERIC, an AMOUNT, or a String.
-
format
public java.lang.String format(java.math.BigDecimal value, int length)
Formats the BigDecimal as an AMOUNT, NUMERIC, or a String.
-
value
public <T> IsoValue<T> value(T val, int len)
-
value
public <T> IsoValue<T> value(T val)
-
call
public <T> IsoValue<T> call(T val, int len)
-
call
public <T> IsoValue<T> call(T val)
-
apply
public <T> IsoValue<T> apply(T val, int len)
-
apply
public <T> IsoValue<T> apply(T val)
-
-