Class LicenseSetFactory

java.lang.Object
org.apache.rat.license.LicenseSetFactory

public class LicenseSetFactory extends Object
Class to take a set of ILicenses and collection of approved license categories and extract Subsets.
  • Constructor Details

    • LicenseSetFactory

      public LicenseSetFactory(SortedSet<ILicense> licenses, Collection<String> approvedLicenses)
      Constructs a factory with the specified set of Licenses and the approved license collection.
      Parameters:
      licenses - the set of defined licenses.
      approvedLicenses - the list of approved licenses.
  • Method Details

    • emptyLicenseSet

      public static SortedSet<ILicense> emptyLicenseSet()
      Create an empty sorted Set with proper comparator.
      Returns:
      An empty sorted set of ILicense objects.
    • getLicenses

      public SortedSet<ILicense> getLicenses(LicenseSetFactory.LicenseFilter filter)
      Gets the License objects based on the filter.
      Parameters:
      filter - the types of LicenseFamily objects to return.
      Returns:
      a SortedSet of ILicense objects.
    • getLicenseFamilies

      public SortedSet<ILicenseFamily> getLicenseFamilies(LicenseSetFactory.LicenseFilter filter)
      Gets the LicenseFamily objects based on the filter.
      Parameters:
      filter - the types of LicenseFamily objects to return.
      Returns:
      a SortedSet of ILicenseFamily objects.
    • getLicenseFamilyIds

      public SortedSet<String> getLicenseFamilyIds(LicenseSetFactory.LicenseFilter filter)
      Gets the categories of LicenseFamily objects based on the filter.
      Parameters:
      filter - the types of LicenseFamily objects to return.
      Returns:
      a SortedSet of ILicenseFamily categories.
    • search

      public static ILicense search(String licenseId, SortedSet<ILicense> licenses)
      Search a SortedSet of licenses for the matching license id.
      Parameters:
      licenseId - the id to search for.
      licenses - the SortedSet of licenses to search.
      Returns:
      the matching license or null if not found.
    • search

      public static ILicense search(ILicense target, SortedSet<ILicense> licenses)
      Search a SortedSet of licenses for the matching license.
      Parameters:
      target - the license to search for.
      licenses - the SortedSet of licenses to search.
      Returns:
      the matching license or null if not found.