|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.jp.protection.priv.pro.SerialNumberBase
com.jp.protection.priv.pro.SerialNumber2
public class SerialNumber2
This class represents simplified license encoded into the textual form
similar to: BUK3X-9AY4Z-O7NM2-D65WG-UKRXC
. This simple form
allows licenses to be printed on product boxes etc. This version S/N allows
holding of the following license attributes:
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.jp.protection.priv.pro.SerialNumberBase |
---|
SerialNumberBase.KeyCharsGenerator |
Field Summary | |
---|---|
protected long |
fAlias
|
protected static int |
FIELD_INDEX_ALIAS
|
protected static int |
FIELD_INDEX_CRC
|
protected static int |
FIELD_INDEX_LICENSE_NUMBER
|
protected static int |
FIELD_INDEX_NUMBER_COPIES
|
protected static int[] |
FIELD_LENGTH_ARRAY
|
protected long |
fLicenseNumber
|
protected long |
fNumberCopies
|
protected static java.text.NumberFormat |
INTEGER_FORMAT
|
static long |
MAX_ALIAS
|
static int |
MAX_ALIAS_CHARS
|
static long |
MAX_CRC
|
static int |
MAX_CRC_CHARS
|
static long |
MAX_LICENSE_NUMBER
|
static int |
MAX_LICENSE_NUMBER_CHARS
|
static long |
MAX_NUMBER_COPIES
|
static int |
MAX_NUMBER_COPIES_CHARS
|
protected static java.text.MessageFormat |
SERIAL_NUMBER_FORMAT
|
Fields inherited from class com.jp.protection.priv.pro.SerialNumberBase |
---|
fKeyChars, fKeyCharsStartOffset, N_A, PATTERN, PATTERN_CHAR, PATTERN_DELIMITER |
Constructor Summary | |
---|---|
SerialNumber2()
Creates a new instance of the SerialNumber |
|
SerialNumber2(char[] aKeyChars)
Creates a new instance of the SerialNumber and assigns key characters to it |
Method Summary | |
---|---|
protected void |
checkValue(java.lang.String aProperty,
long aValue,
long aMin,
long aMax)
|
void |
decode(java.lang.String aSerialNumber)
Parses textual representation of the Serial Number |
java.lang.String |
encode()
Generates textual representation of the Serial Number |
protected java.lang.String |
excludeCRC(java.lang.String aValue)
|
long |
getAlias()
Returns alias |
long |
getLicenseNumber()
Returns license number |
long |
getNumberCopies()
Return number of copies |
protected int[] |
parseFields(java.lang.String aSerialNumber)
|
void |
setAlias(long aAlias)
Specifies alias |
void |
setLicenseNumber(long aLicenseNumber)
Specifies license number |
void |
setNumberCopies(long aNumberCopies)
Specifies number of copies |
protected long |
trancateCRC(long aCRC)
|
Methods inherited from class com.jp.protection.priv.pro.SerialNumberBase |
---|
checkValidChars, contains, decode, encode, encode, generateCRC, getKeyChars, getOffset, invalidSerialNumberError, keyCharsNotSpecifiedError, setKeyChars |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final long MAX_CRC
public static final long MAX_LICENSE_NUMBER
public static final long MAX_ALIAS
public static final long MAX_NUMBER_COPIES
public static final int MAX_CRC_CHARS
public static final int MAX_LICENSE_NUMBER_CHARS
public static final int MAX_ALIAS_CHARS
public static final int MAX_NUMBER_COPIES_CHARS
protected long fAlias
protected long fLicenseNumber
protected long fNumberCopies
protected static java.text.MessageFormat SERIAL_NUMBER_FORMAT
protected static int[] FIELD_LENGTH_ARRAY
protected static final int FIELD_INDEX_CRC
protected static final int FIELD_INDEX_LICENSE_NUMBER
protected static final int FIELD_INDEX_NUMBER_COPIES
protected static final int FIELD_INDEX_ALIAS
protected static java.text.NumberFormat INTEGER_FORMAT
Constructor Detail |
---|
public SerialNumber2()
SerialNumber
public SerialNumber2(char[] aKeyChars)
SerialNumber
and assigns key characters to it
aKeyChars
- key charactersMethod Detail |
---|
protected void checkValue(java.lang.String aProperty, long aValue, long aMin, long aMax) throws SerialNumberException
SerialNumberException
public long getAlias()
public void setAlias(long aAlias)
aAlias
- alias
SerialNumberException
- if alias has an invalid valuepublic long getNumberCopies()
public void setNumberCopies(long aNumberCopies)
aNumberCopies
- number of copiespublic long getLicenseNumber()
public void setLicenseNumber(long aLicenseNumber) throws SerialNumberException
aLicenseNumber
- license number
SerialNumberException
- if license number has an invalid valuepublic java.lang.String encode() throws SerialNumberException
encode
in class SerialNumberBase
SerialNumberException
- on any errorsprotected java.lang.String excludeCRC(java.lang.String aValue)
protected long trancateCRC(long aCRC)
public void decode(java.lang.String aSerialNumber) throws SerialNumberException
decode
in class SerialNumberBase
aSerialNumber
- textual representation of the Serial Number
SerialNumberException
- if provided textual representation of the Serial Number is invalidprotected int[] parseFields(java.lang.String aSerialNumber)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |