Package rs.baselib.licensing
Interface ILicenseContext
- All Known Implementing Classes:
DefaultLicenseContext
public interface ILicenseContext
A container holding properties for creation and verification of licenses.
- Author:
- ralph
-
Method Summary
Modifier and Type Method Description <T> Tget(java.lang.Class<T> clazz)Returns the property of given class.java.lang.Objectget(java.lang.String key)Returns the property with given key.java.lang.Iterable<java.lang.String>getKeys()Returns the property keys.booleanhasKey(java.lang.Class<?> clazz)Returns whether the context has such a value.booleanhasKey(java.lang.String key)Returns whether the context has such a value.<T> Tremove(java.lang.Class<T> clazz)Removes the property of given class.java.lang.Objectremove(java.lang.String key)Removes the property with given key.<T> voidset(java.lang.Class<T> clazz, T value)Sets the property.voidset(java.lang.String key, java.lang.Object value)Sets the property.
-
Method Details
-
get
java.lang.Object get(java.lang.String key)Returns the property with given key.- Parameters:
key- key of property- Returns:
- the value or
nullif the property doesn't exist
-
get
<T> T get(java.lang.Class<T> clazz)Returns the property of given class. The class parameter will be the key of the property.- Type Parameters:
T- type of value- Parameters:
clazz- type of property- Returns:
- the value or
nullif the property doesn't exist
-
hasKey
boolean hasKey(java.lang.Class<?> clazz)Returns whether the context has such a value.- Parameters:
clazz- the clazz to look for (name is key)- Returns:
truewhen context has this key
-
hasKey
boolean hasKey(java.lang.String key)Returns whether the context has such a value.- Parameters:
key- the key to look for- Returns:
truewhen context has this key
-
set
void set(java.lang.String key, java.lang.Object value)Sets the property.- Parameters:
key- key of propertyvalue- value
-
set
<T> void set(java.lang.Class<T> clazz, T value)Sets the property. The property key will be the name of the class parameter.- Type Parameters:
T- type of value- Parameters:
clazz- class of propertyvalue- value
-
remove
java.lang.Object remove(java.lang.String key)Removes the property with given key.- Parameters:
key- key of property- Returns:
- the value that was removed
-
remove
<T> T remove(java.lang.Class<T> clazz)Removes the property of given class. The key of the removed property is the class parameter name.- Type Parameters:
T- type of value- Parameters:
clazz- class of property- Returns:
- the value that was removed
-
getKeys
java.lang.Iterable<java.lang.String> getKeys()Returns the property keys.- Returns:
- an iterable of all property keys
-