
public final class AlphaNumericText27 extends Object implements CharSequence, Comparable, Serializable
Data type for the alpha-numeric DTAUS alphabet. For further information see the Spezifikation der Datenformate. An updated version of the document may be found at EBICS.
| Modifier and Type | Field and Description |
|---|---|
static int |
MAX_LENGTH
Constant for the maximum length allowed for an instance.
|
| Modifier and Type | Method and Description |
|---|---|
char |
charAt(int index)
Returns the
char value at the specified index. |
static boolean |
checkAlphaNumeric(char c)
Checks a given character to belong to the alpha-numeric alphabet.
|
int |
compareTo(Object o)
Compares this object with the specified object for order.
|
boolean |
equals(Object o)
Indicates whether some other object is equal to this one.
|
String |
format()
Formats alpha-numeric characters to produce a string.
|
StringBuffer |
format(StringBuffer toAppendTo)
Formats alpha-numeric characters and appends the resulting text to the given string buffer.
|
int |
hashCode()
Returns a hash code value for this object.
|
boolean |
isEmpty()
Flag indicating that the instance contains no text.
|
int |
length()
Returns the length of this character sequence.
|
static String |
normalize(String text)
Normalizes text to conform to the alpha-numeric alphabet.
|
static AlphaNumericText27 |
parse(String text)
Parses text from the beginning of the given string to produce an
AlphaNumericText27 instance. |
static AlphaNumericText27 |
parse(String text,
ParsePosition pos)
Parses text from a string to produce an
AlphaNumericText27 instance. |
CharSequence |
subSequence(int start,
int end)
Returns a new
CharSequence that is a subsequence of this sequence. |
String |
toString()
Returns a string containing the characters in this sequence in the same order as this sequence.
|
static String |
toString(AlphaNumericText27 alphaNumericText27)
Formats alpha-numeric characters to produce a string.
|
static AlphaNumericText27 |
valueOf(String text)
Parses text from the beginning of the given string to produce an
AlphaNumericText27 instance. |
public static final int MAX_LENGTH
public char charAt(int index)
char value at the specified index.
An index ranges from zero to length() - 1. The first char value of the sequence is at index
zero, the next at index one, and so on, as for array indexing.
charAt in interface CharSequenceindex - The index of the char value to be returned.char value.IndexOutOfBoundsException - if index is negative or not less than length().public static boolean checkAlphaNumeric(char c)
c - The character to check.true if c is a character of the alpha-numeric DTAUS alphabet; false if not.public int compareTo(Object o)
compareTo in interface Comparableo - The Object to be compared.NullPointerException - if o is null.ClassCastException - if the specified object's type prevents it from being compared to this Object.public String format()
format(new StringBuffer()).toString()
public StringBuffer format(StringBuffer toAppendTo)
toAppendTo - The buffer to which the formatted text is to be appended.toAppendTo.NullPointerException - if toAppendTo is null.public int hashCode()
public boolean isEmpty()
true if the instance contains no text but just whitespace characters; false if the
instance contains text.public int length()
chars in the sequence.length in interface CharSequencechars in this sequence.public static String normalize(String text)
This method converts lower case letters to upper case letters and replaces all illegal characters with spaces.
It will return the unchanged text if for every given character C the method checkAlphaNumeric(C)
returns true.
Note that code like
AlphaNumericText27.parse(AlphaNumericText27.normalize(getSomething()));
may be dangerous if getSomething() may provide unchecked or otherwise invalid data which will get
converted to valid data by this method.
Also note that
AlphaNumericText27.normalize(something).length() == something.length();
is always true although
AlphaNumericText27.normalize(something).equals(something);
may be false.
It is recommended to always check for changes before proceeding with the data this method returns. For example:
something = getSomething();
normalized = AlphaNumericText27.normalize(something);
if(!something.equals(normalized)) {
e.g. check the normalized value, log a warning, display the
normalized value to the user for confirmation
}text - The text to normalize.text normalized to conform to the alpha-numeric alphabet.NullPointerException - if text is null.public static AlphaNumericText27 parse(String text) throws ParseException
AlphaNumericText27 instance.
Unlike the parse(String, ParsePosition) method this method throws a ParseException if
text cannot be parsed or is of invalid length.
text - A string to parse alpha numeric characters from.NullPointerException - if text is null.ParseException - if the parse fails or the length of text is greater than 27.public static AlphaNumericText27 parse(String text, ParsePosition pos)
AlphaNumericText27 instance.
The method attempts to parse text starting at the index given by pos. If parsing succeeds, then the
index of pos is updated to the index after the last character used (parsing does not necessarily use all
characters up to the end of the string), and the parsed value is returned. The updated pos can be used to
indicate the starting point for the next call to this method.
text - A string to parse alpha numeric characters from.pos - A ParsePosition object with index and error index information as described above.null if the parse fails.NullPointerException - if either text or pos is null.public CharSequence subSequence(int start, int end)
CharSequence that is a subsequence of this sequence.
The subsequence starts with the char value at the specified index and ends with the char value
at index end - 1. The length (in chars) of the returned sequence is end - start, so if
start == end then an empty sequence is returned.
subSequence in interface CharSequencestart - The start index, inclusive.end - The end index, exclusive.IndexOutOfBoundsException - if start or end are negative, if end is greater than
length(), or if start is greater than end.public String toString()
toString in interface CharSequencetoString in class Objectpublic static String toString(AlphaNumericText27 alphaNumericText27)
alphaNumericText27.format()
alphaNumericText27 - The AlphaNumericText27 instance to format.NullPointerException - if alphaNumericText27 is null.public static AlphaNumericText27 valueOf(String text)
AlphaNumericText27 instance.
Unlike the parse(String) method this method throws an IllegalArgumentException if
text cannot be parsed or is of invalid length.
text - A formatted string representation of an AlphaNumericText27 instance.NullPointerException - if text is null.IllegalArgumentException - if the parse fails or the length of text is greater than 27.Copyright © 2005–2014 jDTAUS. All rights reserved.