public final class License extends Object implements Serializable, Cloneable
License.Builder.License.Builder,
License.Feature,
Serialized Form| Modifier and Type | Class and Description |
|---|---|
static class |
License.Builder
This class is responsible for all license creation.
|
static class |
License.Feature
A class that represents a licensed feature.
|
| Modifier and Type | Method and Description |
|---|---|
License |
clone()
Performs a deep clone of this license and its content and features.
|
protected static License |
deserialize(byte[] data)
Deserializes a serialized license into an actual License object.
|
boolean |
equals(Object object)
Checks whether the provided license object is identical to this one in content, features and expiration dates,
deeply.
|
ImmutableLinkedHashSet<License.Feature> |
getFeatures()
Returns an immutable (unchangeable) list of all of the features contained within this license.
|
long |
getGoodAfterDate()
Returns the millisecond timestamp for the date after which this license is valid (usually equal or close to the
issue date, but this is not required.)
|
long |
getGoodBeforeDate()
Returns the millisecond timestamp for the date before which this license is valid (i.e., the expiration date).
|
String |
getHolder()
Returns the holder of this license.
|
long |
getIssueDate()
Returns the millisecond timestamp for the issue date of this license.
|
String |
getIssuer()
Returns the issuer of this license.
|
int |
getNumberOfLicenses()
Returns the number of licenses/seats/users that this license is valid for.
|
String |
getProductKey()
Returns the product key for this license.
|
String |
getSubject()
Returns the subject for this license.
|
int |
hashCode()
Calculates a hash code for this license.
|
boolean |
hasLicenseForAllFeatures(FeatureObject... features)
Checks if all of the features specified are licensed in this license.
|
boolean |
hasLicenseForAllFeatures(long currentDate,
FeatureObject... features)
Checks if all of the features specified are licensed in this license.
|
boolean |
hasLicenseForAllFeatures(long currentDate,
String... featureNames)
Checks if all of the features specified are licensed in this license.
|
boolean |
hasLicenseForAllFeatures(String... featureNames)
Checks if all of the features specified are licensed in this license.
|
boolean |
hasLicenseForAnyFeature(FeatureObject... features)
Checks if all of the features specified are licensed in this license.
|
boolean |
hasLicenseForAnyFeature(long currentDate,
FeatureObject... features)
Checks if all of the features specified are licensed in this license.
|
boolean |
hasLicenseForAnyFeature(long currentDate,
String... featureNames)
Checks if all of the features specified are licensed in this license.
|
boolean |
hasLicenseForAnyFeature(String... featureNames)
Checks if all of the features specified are licensed in this license.
|
boolean |
hasLicenseForFeature(FeatureObject feature)
Checks if the feature specified is licensed.
|
boolean |
hasLicenseForFeature(long currentDate,
FeatureObject feature)
Checks if the feature specified is licensed.
|
boolean |
hasLicenseForFeature(long currentDate,
String featureName)
Checks if the feature specified is licensed.
|
boolean |
hasLicenseForFeature(String featureName)
Checks if the feature specified is licensed.
|
byte[] |
serialize()
Serialized this license into a byte array that can be shipped electronically.
|
String |
toString()
Generates a string representation of this license.
|
public byte[] serialize()
protected static License deserialize(byte[] data)
data - The serialized data to create the license frompublic final String getProductKey()
issuer,
holder, and subject are symbolically named; they are interchangeable
and can be used to hold any number of pieces of information. For example, one might use the holder to store a
hardware ID, or the subject to store a product name and version combination.public final String getIssuer()
productKey, issuer,
holder, and subject are symbolically named; they are interchangeable
and can be used to hold any number of pieces of information. For example, one might use the holder to store a
hardware ID, or the subject to store a product name and version combination.public final String getHolder()
productKey, issuer,
holder, and subject are symbolically named; they are interchangeable and can
be used to hold any number of pieces of information. For example, one might use the holder to store a hardware
ID, or the subject to store a product name and version combination.public final String getSubject()
productKey, issuer,
holder, and subject are symbolically named; they are interchangeable and can
be used to hold any number of pieces of information. For example, one might use the holder to store a hardware
ID, or the subject to store a product name and version combination.public final long getIssueDate()
public final long getGoodAfterDate()
public final long getGoodBeforeDate()
public final int getNumberOfLicenses()
public final ImmutableLinkedHashSet<License.Feature> getFeatures()
License.Feature and License.Builder.License.Featurepublic final boolean hasLicenseForFeature(String featureName)
true.featureName - The feature to checktrue if this feature is licensed and valid, false otherwise.public final boolean hasLicenseForFeature(long currentDate,
String featureName)
true.currentDate - The date (millisecond timestamp) to check the feature againstfeatureName - The feature to checktrue if this feature is licensed and valid, false otherwise.public final boolean hasLicenseForFeature(FeatureObject feature)
true.feature - The feature to checktrue if this feature is licensed and valid, false otherwise.public final boolean hasLicenseForFeature(long currentDate,
FeatureObject feature)
true.currentDate - The date (millisecond timestamp) to check the feature againstfeature - The feature to checktrue if this feature is licensed and valid, false otherwise.public final boolean hasLicenseForAnyFeature(String... featureNames)
true. Any features that contain expiration dates are checked against the current date.
Features are only valid if they have no expiration date or they are not expired.featureNames - The features to checktrue if any one feature listed is licensed and valid, false otherwise.public final boolean hasLicenseForAnyFeature(long currentDate,
String... featureNames)
true. Any features that contain expiration dates are checked against the current date.
Features are only valid if they have no expiration date or they are not expired.currentDate - The date (millisecond timestamp) to check features againstfeatureNames - The features to checktrue if any one feature listed is licensed and valid, false otherwise.public final boolean hasLicenseForAnyFeature(FeatureObject... features)
true. Any features that contain expiration dates are checked against the current date.
Features are only valid if they have no expiration date or they are not expired.features - The features to checktrue if any one feature listed is licensed and valid, false otherwise.public final boolean hasLicenseForAnyFeature(long currentDate,
FeatureObject... features)
true. Any features that contain expiration dates are checked against the current date.
Features are only valid if they have no expiration date or they are not expired.currentDate - The date (millisecond timestamp) to check features againstfeatures - The features to checktrue if any one feature listed is licensed and valid, false otherwise.public final boolean hasLicenseForAllFeatures(String... featureNames)
false. Any features that contain expiration dates are checked against the current date.
If any one feature is expired, this method returns false.featureNames - The features to checktrue if every feature listed is licensed and valid, false otherwise.public final boolean hasLicenseForAllFeatures(long currentDate,
String... featureNames)
false. Any features that contain expiration dates are checked against the provided date.
If any one feature is expired, this method returns false.currentDate - The date (millisecond timestamp) to check features againstfeatureNames - The features to checktrue if every feature listed is licensed and valid, false otherwise.public final boolean hasLicenseForAllFeatures(FeatureObject... features)
false. Any features that contain expiration dates are checked against the current date.
If any one feature is expired, this method returns false.features - The features to checktrue if every feature listed is licensed and valid, false otherwise.public final boolean hasLicenseForAllFeatures(long currentDate,
FeatureObject... features)
false. Any features that contain expiration dates are checked against the provided date.
If any one feature is expired, this method returns false.currentDate - The date (millisecond timestamp) to check features againstfeatures - The features to checktrue if every feature listed is licensed and valid, false otherwise.public final boolean equals(Object object)
public final int hashCode()
public final String toString()
Copyright © 2010-2013 NWTS Java Code. All Rights Reserved. Licensed Under the Apache License version 2.0.