|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectkernpruefung.bnz.util.CheckMethods
public class CheckMethods
The class CheckMethods contains all (static) methods to check the rules from the specifications.
This class is a static class without a public c'tor.
| Field Summary | |
|---|---|
static int |
BETRIEBSNUMMER
|
static int |
STICHJAHR
|
static int |
ZAHLSTELLENNUMMER
|
static int |
ZAHLSTELLENNUMMER0
|
| Method Summary | |
|---|---|
static boolean |
hasCorrectAtChar(java.lang.String testString)
Checks if exactly one @ or § is in testString and whether it is not in first or last position. |
static boolean |
hasForeignLDKZ(java.lang.String testLDKZ)
Checks if testLDKZ is a valid LDKZ (see DEÜV Anlage 8)
CheckMethods.hasForeignLDKZ( "" ) == false
CheckMethods.hasForeignLDKZ( " " ) == false
CheckMethods.hasForeignLDKZ( "BHT" ) == true
CheckMethods.hasForeignLDKZ( "IRL" ) == true
CheckMethods.hasForeignLDKZ( "xxx" ) == false
CheckMethods.hasForeignLDKZ( " L " ) == false
|
static boolean |
hasHomePLZ(java.lang.String testPLZ)
Checks if testPLZ is a valid home PLZ between 01000 ... 99999
CheckMethods.hasHomePLZ( "" ) == false
CheckMethods.hasHomePLZ( " " ) == false
CheckMethods.hasHomePLZ( "01000 " ) == true
CheckMethods.hasHomePLZ( "44866 " ) == true
CheckMethods.hasHomePLZ( "00010 " ) == false
CheckMethods.hasHomePLZ( " 44866 " ) == false
|
static boolean |
hasPLZCharsItl(java.lang.String testPLZ)
Checks if testPLZ has valid Itl PLZ chars
|
static boolean |
hasValidEmailCharacters(java.lang.String testString)
Checks if testString contains only valid email characters. |
static boolean |
isANDefaultValue(java.lang.String testString)
Checks if testString has only the defaultValue (string field: all spaces)
|
static boolean |
isCheckDigit(java.lang.String testString,
int p)
Checks if the testString is a valid Zahlstellennummer or Betriebsnummer. |
static boolean |
isConstantString(java.lang.String testString,
java.lang.String constant)
Checks if first argument ( testString)
is equal to the second argument (the constant) and if testString is not
NULL or empty. |
static boolean |
isDate(java.lang.String testDate)
Checks if testDate is a valid date. |
static boolean |
isDate0000(java.lang.String testDate)
Checks if testDate is a valid date and jhjj<2009 or jhjj<2009 and mmtt="0000". |
static boolean |
isDate1LaterDate2(java.lang.String testDate1,
java.lang.String testDate2)
Checks if testDate1 is later than testDate2. |
static boolean |
isDate1NotLaterDate2PlusXMonths(java.lang.String testDate1,
java.lang.String testDate2,
int months)
Checks if testDate1 is not later than end of month from testDate2 plus months. |
static boolean |
isDateNotLaterToday(java.lang.String testDate)
Checks if testDate is not later than current date. |
static boolean |
isEmptyOrNull(java.lang.String testString)
Checks if testString contains only spaces or is NULL or is an empty string. |
static boolean |
isInCharSet(char testChar,
java.lang.String charSet)
Checks if ch is member of the charSet given as a string charSet
|
static boolean |
isNDefaultValue(java.lang.String testString)
Checks if testString has only the defaultValue (numeric field: all Zeros)
|
static boolean |
isNumeric(java.lang.String testString)
Checks if testString contains only digits. |
static boolean |
isTime(java.lang.String testTime)
Checks if testTime is a valid time value. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int ZAHLSTELLENNUMMER0
public static final int ZAHLSTELLENNUMMER
public static final int BETRIEBSNUMMER
public static final int STICHJAHR
| Method Detail |
|---|
public static boolean isEmptyOrNull(java.lang.String testString)
testString contains only spaces or is NULL or is an empty string.
CheckMethods.isEmptyOrNull( null ) == true CheckMethods.isEmptyOrNull( "" ) == true CheckMethods.isEmptyOrNull( " " ) == true CheckMethods.isEmptyOrNull( " " ) == true CheckMethods.isEmptyOrNull( " x a " ) == false CheckMethods.isEmptyOrNull( "abc " ) == false
testString - string that is checked
true if testString contains only spaces or is NULL or is an empty string and false otherwise.public static boolean isNumeric(java.lang.String testString)
testString contains only digits.
CheckMethods.isNumeric( null ) == false CheckMethods.isNumeric( "" ) == false CheckMethods.isNumeric( " " ) == false CheckMethods.isNumeric( "12345" ) == true CheckMethods.isNumeric( "1x2a5" ) == false CheckMethods.isNumeric( "1 234" ) == false
testString - string that is checked
true if testString contains only digits, false otherwise.public static boolean isDate(java.lang.String testDate)
testDate is a valid date.
testDate - string that is checked (format: jhjjmmtt)
true if testDate is a valid date, false otherwise.public static boolean isDate0000(java.lang.String testDate)
testDate is a valid date and jhjj<2009 or jhjj<2009 and mmtt="0000".
testDate - string that is checked (format: jhjjmmtt)
true if testDate is a valid date and jhjj<2009 or jhjj<2009 and mmtt="0000",
false otherwise.public static boolean isDateNotLaterToday(java.lang.String testDate)
testDate is not later than current date.
testDate - string that is checked (format: jhjjmmtt)
true if testDate is not later than current date.public static boolean isTime(java.lang.String testTime)
testTime is a valid time value.
hh >= 00 and hh <= 23
mm >= 00 and mm <= 59
ss >= 00 and ss <= 59
testTime - string that is checked (format: hhmmss)
true if testTime is a valid time value, false otherwise.public static boolean hasValidEmailCharacters(java.lang.String testString)
testString contains only valid email characters.
testString - string that is checked
true if testString contains only valid email characters.public static boolean hasCorrectAtChar(java.lang.String testString)
testString and whether it is not in first or last position.
testString - string that is checked
true if exactly one @ or § is in testString and is not in first or last position, false otherwise.
public static boolean isCheckDigit(java.lang.String testString,
int p)
testString is a valid Zahlstellennummer or Betriebsnummer.An obligate parameter specifies the check:
param=ZAHLSTELLENNUMMER : Checks if the first 3 positions are resp. 106, 107 or 108 and
if the 8. digit is a valid check digit following spec DEÜV 1.3.2.2 .
param=BETRIEBSNUMMER : Checks if the first 3 positions are in the range 001 to 099 or greater
than 110 and if the 8. digit is a valid check digit following spec
DEÜV 1.3.2.2 .
The check digit is specified as followed (1.3.2.2 of DEÜV):
Example: 87661207 ==> pos : 1 2 3 4 5 6 7 8 (pos 8 = check digit)
========
Digit : 8 7 6 6 1 2 0 7
factor 1-7: 1 2 1 2 1 2 1
+--Calculation--------------------------------------------------------+
! weighted sum: 8 14 6 12 1 4 0 !
! sum of digits: 8 5 6 3 1 4 0 !
! sum: 27 !
! remainder from division by 10: 7 <--check digit !
!alternative check digit: !
! check digit + 5: 12 !
! last digit: 2 <--alternative check digit !
! !
! result: valid check digit is : 7 or 2 !
+---------------------------------------------------------------------+
testString - testStringp - specifies the test variant
true if testString is a valid Betriebsnummer or Zahlstellennummer
public static boolean isConstantString(java.lang.String testString,
java.lang.String constant)
testString)
is equal to the second argument (the constant) and if testString is not
NULL or empty.
testString - test string that is compared with constantconstant - the constant for that the check is performed
true if testString is equal to the constant, otherwise false
public static boolean isInCharSet(char testChar,
java.lang.String charSet)
ch is member of the charSet given as a string charSet
testChar - charSet -
true if charSet contains the testChar, false otherwise
public static boolean isDate1LaterDate2(java.lang.String testDate1,
java.lang.String testDate2)
testDate1 is later than testDate2.
If testDate1 or testDate2 is NULL it is replaced with current Date
testDate1 - (Format: jhjjmmtt)testDate2 - (Format: jhjjmmtt)
true if testDate1 is later than testDate2, otherwise false
public static boolean isDate1NotLaterDate2PlusXMonths(java.lang.String testDate1,
java.lang.String testDate2,
int months)
testDate1 is not later than end of month from testDate2 plus months.
If testDate1 or testDate2 is NULL it is replaced with current Date
testDate1 - (Format: jhjjmmtt)testDate2 - (Format: jhjjmmtt)
true if testDate1 is not later than end of month from testDate2 plus months,
otherwise falsepublic static boolean isNDefaultValue(java.lang.String testString)
testString has only the defaultValue (numeric field: all Zeros)
testString -
true if testString has only the defaultValue (numeric field:all Zeros), otherwise falsepublic static boolean isANDefaultValue(java.lang.String testString)
testString has only the defaultValue (string field: all spaces)
testString -
true if testString has only the defaultValue (string field: all spaces), otherwise falsepublic static boolean hasForeignLDKZ(java.lang.String testLDKZ)
testLDKZ is a valid LDKZ (see DEÜV Anlage 8)
CheckMethods.hasForeignLDKZ( "" ) == false CheckMethods.hasForeignLDKZ( " " ) == false CheckMethods.hasForeignLDKZ( "BHT" ) == true CheckMethods.hasForeignLDKZ( "IRL" ) == true CheckMethods.hasForeignLDKZ( "xxx" ) == false CheckMethods.hasForeignLDKZ( " L " ) == false
testLDKZ -
true if testLDKZ is a valid LDKZ, false otherwisepublic static boolean hasHomePLZ(java.lang.String testPLZ)
testPLZ is a valid home PLZ between 01000 ... 99999
CheckMethods.hasHomePLZ( "" ) == false CheckMethods.hasHomePLZ( " " ) == false CheckMethods.hasHomePLZ( "01000 " ) == true CheckMethods.hasHomePLZ( "44866 " ) == true CheckMethods.hasHomePLZ( "00010 " ) == false CheckMethods.hasHomePLZ( " 44866 " ) == false
testPLZ -
true if testPLZ is a valid home PLZ, false otherwisepublic static boolean hasPLZCharsItl(java.lang.String testPLZ)
testPLZ has valid Itl PLZ chars
testPLZ -
true if testPLZ has valid Itl PLZ chars, false otherwise
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||