Class License

java.lang.Object
org.apache.creadur.whisker.model.License
All Implemented Interfaces:
Comparable<License>

public class License extends Object implements Comparable<License>
Describes a software license.
  • Constructor Details

    • License

      public License(boolean isSourceRequired, String baseText, Collection<String> expectedParameters, String id, String url, String name)
      Constructs meta-data for a family of licenses.
      Parameters:
      isSourceRequired - true if this license requires information about source distribution to be included within the distribution
      baseText - a template for the legal text, not null
      expectedParameters - not null
      id - not null
      url - not null
      name - not null
  • Method Details

    • isSourceRequired

      public boolean isSourceRequired()
      Is source information inclusion required by this license?
      Returns:
      true when information about the source should be included, false otherwise
    • getText

      public String getText() throws LicenseTemplateException
      Gets legal text expressing this license.
      Returns:
      not null
      Throws:
      LicenseTemplateException - when the text cannot be created from the template
    • getText

      public String getText(Map<String,String> parameters) throws LicenseTemplateException
      Gets legal text expressing this license,
      Parameters:
      parameters - possibly null
      Returns:
      not null
      Throws:
      LicenseTemplateException - when the text cannot be created from the template
    • getExpectedParameters

      public Collection<String> getExpectedParameters()
      Gets parameters required by the template to generate a instance of this license family.
      Returns:
      not null, possibly empty
    • storeIn

      public License storeIn(Map<String,License> map)
      Stores the license by its id.
      Parameters:
      map - not null
      Returns:
      the license stored
    • getId

      public String getId()
      Gets the unique identifier for this license.
      Returns:
      not null
    • getURL

      public String getURL()
      Gets a locator for this license.
      Returns:
      not null
    • getName

      public String getName()
      Gets a name for this license suitable for display.
      Returns:
      not null
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
      See Also:
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
      See Also:
    • compareTo

      public int compareTo(License other)
      Specified by:
      compareTo in interface Comparable<License>
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object