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

  • Constructor Summary

    Constructors 
    Constructor Description
    AbstractLicense()
    Constructor.
  • Method Summary

    Modifier and Type Method Description
    java.lang.Object getProperty​(java.lang.String key)
    Sets the property of the license.
    java.lang.Iterable<java.lang.String> getPropertyNames()
    Returns all property names.
    boolean hasProperty​(java.lang.String key)
    Returns whether the property is set.
    protected java.lang.Object initProperty​(java.lang.String key, ILicenseContext context)
    Initializes the given property from the context.
    java.lang.Object removeProperty​(java.lang.String key)
    Removes the property of the license.
    void setProperty​(java.lang.String key, java.lang.Object value)
    Sets the property of the license.
    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.
    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.
    protected void verifyEquals​(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 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.
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface rs.baselib.licensing.ILicense

    init, verify
  • Constructor Details

  • Method Details

    • setProperty

      public void setProperty​(java.lang.String key, java.lang.Object value)
      Sets the property of the license.
      Parameters:
      key - key of property
      value - 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:
      true when 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

      protected java.lang.Object initProperty​(java.lang.String key, ILicenseContext context)
      Initializes the given property from the context.
      Parameters:
      key - key to be used in context and property map
      context - context to initialize from
      Returns:
      value found
    • verifyEquals

      protected void verifyEquals​(java.lang.String key, ILicenseContext context, boolean failIfMissing)
      Verifies that the given value of this license is equal to the property in the context.
      Parameters:
      key - key of property
      context - context containing the comparison value
      failIfMissing - 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 property
      context - context containing the comparison value
      failIfMissing - 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 property
      context - context containing the comparison value
      failIfMissing - 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 property
      context - context containing the comparison value
      failIfMissing - 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 property
      context - context containing the comparison value
      failIfMissing - fail the verification when this license has no such value