Class Feature
- java.lang.Object
-
- javax0.license3j.Feature
-
public class Feature extends java.lang.Object
A feature is a single "feature" in a license. It has a- name,
- a type
- and a value.
Feature.Type
.There is a utility class inside this class called
Feature.Create
that contains public static methods to create features for each type. Invoking one of those methods is the way to create a new feature instance.A feature can be tested against the type calling one of the
boolean
methodsisXXX()
, whereXXX
is one of the types. Getting the value from a type should be via the methodsgetXXX
, where, again,XXX
is one of the types. InvokinggetXXX
for a feature that has a type that is notXXX
will throwIllegalArgumentException
.Features can be serialized to a byte array invoking the method
serialized()
. The same byte array can be used as an argument to the utility methodFeature.Create.from(byte[])
to create aFeature
of the same name and the same value.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Feature.Create
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.math.BigDecimal
getBigDecimal()
java.math.BigInteger
getBigInteger()
byte[]
getBinary()
byte
getByte()
java.util.Date
getDate()
double
getDouble()
float
getFloat()
int
getInt()
long
getLong()
short
getShort()
java.lang.String
getString()
java.util.UUID
getUUID()
boolean
isBigDecimal()
boolean
isBigInteger()
boolean
isBinary()
boolean
isByte()
boolean
isDate()
boolean
isDouble()
boolean
isFloat()
boolean
isInt()
boolean
isLong()
boolean
isShort()
boolean
isString()
boolean
isUUID()
java.lang.String
name()
byte[]
serialized()
Convert a feature to byte array.java.lang.String
toString()
java.lang.String
valueString()
-
-
-
Method Detail
-
name
public java.lang.String name()
- Returns:
- the name of the feature.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
valueString
public java.lang.String valueString()
- Returns:
- the string representation of the value of the feature.
-
serialized
public byte[] serialized()
Convert a feature to byte array. The bytes will have the following structure[4-byte type][4-byte name length][4-byte value length][name][value]
or[4-byte type][4-byte name length][name][value]
if the length of the value can be determined from the type (some types have fixed length values).- Returns:
- the byte array representation of the feature
-
isBinary
public boolean isBinary()
-
isString
public boolean isString()
-
isByte
public boolean isByte()
-
isShort
public boolean isShort()
-
isInt
public boolean isInt()
-
isLong
public boolean isLong()
-
isFloat
public boolean isFloat()
-
isDouble
public boolean isDouble()
-
isBigInteger
public boolean isBigInteger()
-
isBigDecimal
public boolean isBigDecimal()
-
isDate
public boolean isDate()
-
isUUID
public boolean isUUID()
-
getBinary
public byte[] getBinary()
-
getString
public java.lang.String getString()
-
getByte
public byte getByte()
-
getShort
public short getShort()
-
getInt
public int getInt()
-
getLong
public long getLong()
-
getFloat
public float getFloat()
-
getDouble
public double getDouble()
-
getBigInteger
public java.math.BigInteger getBigInteger()
-
getBigDecimal
public java.math.BigDecimal getBigDecimal()
-
getUUID
public java.util.UUID getUUID()
-
getDate
public java.util.Date getDate()
-
-