Class Feature
- java.lang.Object
-
- javax0.license3j.Feature
-
public class Feature extends java.lang.ObjectA 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.Createthat 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
booleanmethodsisXXX(), whereXXXis one of the types. Getting the value from a type should be via the methodsgetXXX, where, again,XXXis one of the types. InvokinggetXXXfor a feature that has a type that is notXXXwill 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 aFeatureof the same name and the same value.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classFeature.Create
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.math.BigDecimalgetBigDecimal()java.math.BigIntegergetBigInteger()byte[]getBinary()bytegetByte()java.util.DategetDate()doublegetDouble()floatgetFloat()intgetInt()longgetLong()shortgetShort()java.lang.StringgetString()java.util.UUIDgetUUID()booleanisBigDecimal()booleanisBigInteger()booleanisBinary()booleanisByte()booleanisDate()booleanisDouble()booleanisFloat()booleanisInt()booleanisLong()booleanisShort()booleanisString()booleanisUUID()java.lang.Stringname()byte[]serialized()Convert a feature to byte array.java.lang.StringtoString()java.lang.StringvalueString()
-
-
-
Method Detail
-
name
public java.lang.String name()
- Returns:
- the name of the feature.
-
toString
public java.lang.String toString()
- Overrides:
toStringin 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()
-
-