public final class Kontonummer extends Number implements Comparable
A Kontonummer is a positive integer with a maximum of ten digits.
Modifier and Type | Field and Description |
---|---|
static int |
ELECTRONIC_FORMAT
Constant for the electronic format of a Kontonummer.
|
static int |
LETTER_FORMAT
Constant for the letter format of a Kontonummer.
|
static int |
MAX_CHARACTERS
Maximum number of characters of a Kontonummer.
|
static int |
MAX_DIGITS
Maximum number of digits of a Kontonummer.
|
Modifier and Type | Method and Description |
---|---|
static boolean |
checkKontonummer(Number accountCode)
Checks a given number to conform to a Kontonummer.
|
int |
compareTo(Object o)
Compares this object with the specified object for order.
|
double |
doubleValue()
Returns this Kontonummer as a double value.
|
boolean |
equals(Object o)
Indicates whether some other object is equal to this one.
|
float |
floatValue()
Returns this Kontonummer as a float value.
|
String |
format(int style)
Formats a Kontonummer to produce a string.
|
StringBuffer |
format(int style,
StringBuffer toAppendTo)
Formats a Kontonummer and appends the resulting text to the given string buffer.
|
int |
hashCode()
Returns a hash code value for this object.
|
int |
intValue()
Returns this Kontonummer as an int value.
|
long |
longValue()
Returns this Kontonummer as a long value.
|
static Kontonummer |
parse(String accountCode)
Parses text from the beginning of the given string to produce a
Kontonummer . |
static Kontonummer |
parse(String accountCode,
ParsePosition pos)
Parses text from a string to produce a
Kontonummer . |
String |
toString()
Returns a string representation of the object.
|
static String |
toString(Kontonummer kontonummer)
Formats a Kontonummer to produce a string.
|
static Kontonummer |
valueOf(Number accountCode)
Returns an instance for the Kontonummer identified by the given number.
|
static Kontonummer |
valueOf(String accountCode)
Parses text from the beginning of the given string to produce a
Kontonummer . |
byteValue, shortValue
public static final int ELECTRONIC_FORMAT
The electronic format of a Kontonummer is a ten digit number with leading zeros omitted (e.g. 6789).
public static final int LETTER_FORMAT
The letter format of a Kontonummer is a ten digit number with leading zeros omitted separated by spaces between the first three digits and the second three digits, the second three digits and the third three digits, and between the third three digits and the lastdigit (e.g. 123 456 789 0).
public static final int MAX_CHARACTERS
public static final int MAX_DIGITS
public static boolean checkKontonummer(Number accountCode)
accountCode
- The number to check.true
if accountCode
is a valid Kontonummer; false
if not.public int compareTo(Object o)
compareTo
in interface Comparable
o
- 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 double doubleValue()
doubleValue
in class Number
public float floatValue()
floatValue
in class Number
public String format(int style)
format(style, new StringBuffer()).toString()
style
- The style to use (ELECTRONIC_FORMAT
or LETTER_FORMAT
).IllegalArgumentException
- if style
is neither ELECTRONIC_FORMAT
nor LETTER_FORMAT
.ELECTRONIC_FORMAT
,
LETTER_FORMAT
public StringBuffer format(int style, StringBuffer toAppendTo)
style
- The style to use (ELECTRONIC_FORMAT
or LETTER_FORMAT
).toAppendTo
- The buffer to which the formatted text is to be appended.toAppendTo
.NullPointerException
- if toAppendTo
is null
.IllegalArgumentException
- if style
is neither ELECTRONIC_FORMAT
nor LETTER_FORMAT
.ELECTRONIC_FORMAT
,
LETTER_FORMAT
public int hashCode()
public int intValue()
public long longValue()
public static Kontonummer parse(String accountCode) throws ParseException
Kontonummer
.
Unlike the parse(String, ParsePosition)
method this method throws a ParseException
if
accountCode
cannot be parsed or is of invalid length.
accountCode
- A Kontonummer in either electronic or letter format.NullPointerException
- if accountCode
is null
.ParseException
- if the parse fails or accountCode
is of invalid length.public static Kontonummer parse(String accountCode, ParsePosition pos)
Kontonummer
.
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.
accountCode
- A Kontonummer in either electronic or letter format.pos
- A ParsePosition
object with index and error index information as described above.null
if the parse fails.NullPointerException
- if either accountCode
or pos
is null
.public static String toString(Kontonummer kontonummer)
kontonummer.format(ELECTRONIC_FORMAT)
kontonummer
- The Kontonummer
instance to format.NullPointerException
- if kontonummer
is null
.public static Kontonummer valueOf(Number accountCode)
accountCode
- A number identifying a Kontonummer.accountCode
.NullPointerException
- if accountCode
is null
.IllegalArgumentException
- if accountCode
is negative, zero or greater than 9999999999.checkKontonummer(Number)
public static Kontonummer valueOf(String accountCode)
Kontonummer
.
Unlike the parse(String)
method this method throws an IllegalArgumentException
if
accountCode
cannot be parsed or is of invalid length.
accountCode
- A Kontonummer in either electronic or letter format.NullPointerException
- if accountCode
is null
.IllegalArgumentException
- if the parse fails or accountCode
is of invalid length.Copyright © 2005–2014 jDTAUS. All rights reserved.