@ParametersAreNullableByDefault @Nullable public class License extends Object
null by default.
However, license validation may fail
if some properties are null when
creating,
installing or
verifying
license keys.
There are two options for extending a license with custom properties:
equals(Object), too.
If you do, you also need to override hashCode() for consistency.
Codec of the
respective license key format - see CodecProvider.codec().
This is easiest to achieve if the respective class follows the JavaBean
pattern just like this class does.
Note that this class deviates from the JavaBeans specification in that it
neither implements Serializable nor
Externalizable.
This is because object serialization is not required with the used
Codecs and creates a major obligation for any subclass.
LicenseProvider| Constructor and Description |
|---|
License() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
equals(Object obj)
|
int |
getConsumerAmount()
Returns the amount of consumers which are allowed to use the licensing
subject.
|
String |
getConsumerType()
Returns the description of the type of the entity or object which
allocates (consumes) the license for using the licensing subject.
|
Object |
getExtra()
Returns the license extra data.
|
X500Principal |
getHolder()
Returns the distinguished name of the legal entity to which the license
is granted by the issuer/vendor, typically the consumer.
|
String |
getInfo()
Returns the license information.
|
Date |
getIssued()
Returns the date/time when the license has been issued.
|
X500Principal |
getIssuer()
Returns the distinguished name of the legal entity which grants the
license to the holder/consumer, typically the license vendor.
|
Date |
getNotAfter()
Returns the date/time when the license ends to be valid (expires).
|
Date |
getNotBefore()
Returns the date/time when the license begins to be valid.
|
String |
getSubject()
Returns the description of the product which requires licensing.
|
int |
hashCode()
Returns a hash code which is consistent with
equals(Object). |
void |
setConsumerAmount(int consumerAmount)
Sets the amount of consumers which are allowed to use the licensing
subject.
|
void |
setConsumerType(String consumerType)
Sets the description of the type of the entity or object which
allocates (consumes) the license for using the licensing subject.
|
void |
setExtra(Object extra)
Sets the license extra data.
|
void |
setHolder(X500Principal holder)
Sets the distinguished name of the legal entity to which the license
is granted by the issuer/vendor, typically the consumer.
|
void |
setInfo(String info)
Sets the license information.
|
void |
setIssued(Date issued)
Sets the date/time when the license has been issued.
|
void |
setIssuer(X500Principal issuer)
Sets the distinguished name of the legal entity which grants the
license to the holder/consumer, typically the license vendor.
|
void |
setNotAfter(Date notAfter)
Sets the date/time when the license ends to be valid (expires).
|
void |
setNotBefore(Date notBefore)
Sets the date/time when the license begins to be valid.
|
void |
setSubject(String subject)
Sets the description of the product which requires licensing.
|
void |
setTerm(int days)
Conveniently computes the
issued date/time, notBefore
date/time and notAfter date/time properties from the given
number of days. |
String |
toString()
Returns a string representation of this object for logging and debugging
purposes.
|
public boolean equals(Object obj)
public final int getConsumerAmount()
public final String getConsumerType()
"User".public final Object getExtra()
public final X500Principal getHolder()
new X500Principal("CN=Unknown").public final String getInfo()
public final Date getIssued()
public final X500Principal getIssuer()
new X500Principal("CN=Christian Schlichtherle,O=Schlichtherle IT Services").public final Date getNotAfter()
public final Date getNotBefore()
public final String getSubject()
"MyApp 1.X".public int hashCode()
equals(Object).public final void setConsumerAmount(int consumerAmount)
public final void setConsumerType(String consumerType)
public final void setExtra(Object extra)
extra - the license extra data.
This may be any object which is supported by the configured
codec.public final void setHolder(X500Principal holder)
X500PrincipalBuilderpublic final void setInfo(String info)
public final void setIssued(Date issued)
public final void setIssuer(X500Principal issuer)
X500PrincipalBuilderpublic final void setNotAfter(Date notAfter)
public final void setNotBefore(Date notBefore)
public final void setSubject(String subject)
public final void setTerm(int days)
issued date/time, notBefore
date/time and notAfter date/time properties from the given
number of days.
Note that this computation depends on the system clock unless the
property issued is set.
This is not a security issue because this method is neither used for
license initialization nor validation by a license consumer manager.
days - the validity period in (24 hour) days from now.Copyright © 2005–2017 Schlichtherle IT Services. All rights reserved.