Package rs.baselib.licensing
Class AbstractLicense
java.lang.Object
rs.baselib.licensing.AbstractLicense
- All Implemented Interfaces:
java.io.Serializable,ILicense
- Direct Known Subclasses:
DefaultLicense,SimpleLicense
public abstract class AbstractLicense extends java.lang.Object implements ILicense
Abstract implementation of a license.
- Author:
- ralph
- See Also:
- Serialized Form
-
Field Summary
Fields inherited from interface rs.baselib.licensing.ILicense
EXPIRATION_DATE_KEY, MAXIMUM_VERSION_INCLUDED_KEY, MAXIMUM_VERSION_KEY, MINIMUM_VERSION_INCLUDED_KEY, MINIMUM_VERSION_KEY, OWNER_KEY, PRODUCT_KEY, VERSION_KEY -
Constructor Summary
Constructors Constructor Description AbstractLicense()Constructor. -
Method Summary
Modifier and Type Method Description java.lang.ObjectgetProperty(java.lang.String key)Sets the property of the license.java.lang.Iterable<java.lang.String>getPropertyNames()Returns all property names.booleanhasProperty(java.lang.String key)Returns whether the property is set.protected java.lang.ObjectinitProperty(java.lang.String key, ILicenseContext context)Initializes the given property from the context.java.lang.ObjectremoveProperty(java.lang.String key)Removes the property of the license.voidsetProperty(java.lang.String key, java.lang.Object value)Sets the property of the license.protected voidverifyEqualGreaterThan(java.lang.String key, ILicenseContext context, boolean failIfMissing)Verifies that the given value of this license is greater than or equal to the property in the context.protected voidverifyEqualLessThan(java.lang.String key, ILicenseContext context, boolean failIfMissing)Verifies that the given value of this license is less than or equal to the property in the context.protected voidverifyEquals(java.lang.String key, ILicenseContext context, boolean failIfMissing)Verifies that the given value of this license is equal to the property in the context.protected voidverifyGreaterThan(java.lang.String key, ILicenseContext context, boolean failIfMissing)Verifies that the given value of this license is greater than the property in the context.protected voidverifyLessThan(java.lang.String key, ILicenseContext context, boolean failIfMissing)Verifies that the given value of this license is less than the property in the context.
-
Constructor Details
-
AbstractLicense
public AbstractLicense()Constructor.
-
-
Method Details
-
setProperty
public void setProperty(java.lang.String key, java.lang.Object value)Sets the property of the license.- Parameters:
key- key of propertyvalue- value of property
-
getProperty
public java.lang.Object getProperty(java.lang.String key)Sets the property of the license.- Parameters:
key- key of property- Returns:
- value of property
-
hasProperty
public boolean hasProperty(java.lang.String key)Returns whether the property is set.- Parameters:
key- key of property- Returns:
truewhen property exists
-
removeProperty
public java.lang.Object removeProperty(java.lang.String key)Removes the property of the license.- Parameters:
key- key of property- Returns:
- value that was rmeoved
-
getPropertyNames
public java.lang.Iterable<java.lang.String> getPropertyNames()Returns all property names.- Returns:
- property names as iterable interface
-
initProperty
Initializes the given property from the context.- Parameters:
key- key to be used in context and property mapcontext- context to initialize from- Returns:
- value found
-
verifyEquals
Verifies that the given value of this license is equal to the property in the context.- Parameters:
key- key of propertycontext- context containing the comparison valuefailIfMissing- fail the verification when this license has no such value
-
verifyGreaterThan
protected void verifyGreaterThan(java.lang.String key, ILicenseContext context, boolean failIfMissing)Verifies that the given value of this license is greater than the property in the context.- Parameters:
key- key of propertycontext- context containing the comparison valuefailIfMissing- fail the verification when this license has no such value
-
verifyEqualGreaterThan
protected void verifyEqualGreaterThan(java.lang.String key, ILicenseContext context, boolean failIfMissing)Verifies that the given value of this license is greater than or equal to the property in the context.- Parameters:
key- key of propertycontext- context containing the comparison valuefailIfMissing- fail the verification when this license has no such value
-
verifyLessThan
protected void verifyLessThan(java.lang.String key, ILicenseContext context, boolean failIfMissing)Verifies that the given value of this license is less than the property in the context.- Parameters:
key- key of propertycontext- context containing the comparison valuefailIfMissing- fail the verification when this license has no such value
-
verifyEqualLessThan
protected void verifyEqualLessThan(java.lang.String key, ILicenseContext context, boolean failIfMissing)Verifies that the given value of this license is less than or equal to the property in the context.- Parameters:
key- key of propertycontext- context containing the comparison valuefailIfMissing- fail the verification when this license has no such value
-