Class License

  • All Implemented Interfaces:
    java.lang.Comparable<License>
    Direct Known Subclasses:
    LicenseType, LicenseType

    public abstract class License
    extends java.lang.Object
    implements java.lang.Comparable<License>
    License text, with an optional license XML reference.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String LICENSE_DIR
      The name of the directory used to store tokens indicating approval of licenses.
    • Constructor Summary

      Constructors 
      Constructor Description
      License()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      boolean checkAccepted​(java.nio.file.Path repositoryRoot)
      Checks whether this license has previously been accepted.
      int compareTo​(License otherLicense)  
      boolean equals​(java.lang.Object obj)  
      abstract java.lang.String getId()
      Gets the ID of this license, used to refer to it from within a RepoPackage.
      java.lang.String getLicenseHash()
      Returns the hash of the license text, used for persisting acceptance.
      java.lang.String getType()
      Gets the type of the license.
      abstract java.lang.String getValue()
      Gets the text of the license.
      int hashCode()  
      boolean setAccepted​(java.nio.file.Path repositoryRoot)
      Marks this license as accepted.
      abstract void setId​(java.lang.String id)
      Sets the ID of this license, used to refer to it from within a RepoPackage.
      void setType​(java.lang.String type)
      Sets the type of the license.
      abstract void setValue​(java.lang.String value)
      Sets the text of the license.
      java.lang.String toString()
      Returns a string representation of the license, useful for debugging.
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • LICENSE_DIR

        public static final java.lang.String LICENSE_DIR
        The name of the directory used to store tokens indicating approval of licenses.
        See Also:
        Constant Field Values
    • Constructor Detail

      • License

        public License()
    • Method Detail

      • getId

        @NonNull
        public abstract java.lang.String getId()
        Gets the ID of this license, used to refer to it from within a RepoPackage.
      • setId

        public abstract void setId​(@NonNull
                                   java.lang.String id)
        Sets the ID of this license, used to refer to it from within a RepoPackage.
      • getValue

        @NonNull
        public abstract java.lang.String getValue()
        Gets the text of the license.
      • setValue

        public abstract void setValue​(java.lang.String value)
        Sets the text of the license.
      • getType

        @Nullable
        public java.lang.String getType()
        Gets the type of the license. Currently only "text" is valid.
      • setType

        public void setType​(@Nullable
                            java.lang.String type)
        Sets the type of the license. Currently only "text" is valid.
      • getLicenseHash

        @NonNull
        public java.lang.String getLicenseHash()
        Returns the hash of the license text, used for persisting acceptance. Never null.
      • toString

        public java.lang.String toString()
        Returns a string representation of the license, useful for debugging. This is not designed to be shown to the user.
        Overrides:
        toString in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • equals

        public boolean equals​(@Nullable
                              java.lang.Object obj)
        Overrides:
        equals in class java.lang.Object
      • checkAccepted

        public boolean checkAccepted​(@Nullable
                                     java.nio.file.Path repositoryRoot)
        Checks whether this license has previously been accepted.
        Parameters:
        repositoryRoot - The root directory of the repository
        Returns:
        true if this license has already been accepted
      • setAccepted

        public boolean setAccepted​(@Nullable
                                   java.nio.file.Path repositoryRoot)
        Marks this license as accepted.
        Parameters:
        repositoryRoot - The root directory of the repository
        Returns:
        true if the acceptance was persisted successfully.
      • compareTo

        public int compareTo​(License otherLicense)
        Specified by:
        compareTo in interface java.lang.Comparable<License>