Package com.android.repository.api
Class License
- java.lang.Object
-
- com.android.repository.api.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.StringLICENSE_DIRThe 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 booleancheckAccepted(java.nio.file.Path repositoryRoot)Checks whether this license has previously been accepted.intcompareTo(License otherLicense)booleanequals(java.lang.Object obj)abstract java.lang.StringgetId()Gets the ID of this license, used to refer to it from within aRepoPackage.java.lang.StringgetLicenseHash()Returns the hash of the license text, used for persisting acceptance.java.lang.StringgetType()Gets the type of the license.abstract java.lang.StringgetValue()Gets the text of the license.inthashCode()booleansetAccepted(java.nio.file.Path repositoryRoot)Marks this license as accepted.abstract voidsetId(java.lang.String id)Sets the ID of this license, used to refer to it from within aRepoPackage.voidsetType(java.lang.String type)Sets the type of the license.abstract voidsetValue(java.lang.String value)Sets the text of the license.java.lang.StringtoString()Returns a string representation of the license, useful for debugging.
-
-
-
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
-
-
Method Detail
-
getId
@NonNull public abstract java.lang.String getId()
Gets the ID of this license, used to refer to it from within aRepoPackage.
-
setId
public abstract void setId(@NonNull java.lang.String id)Sets the ID of this license, used to refer to it from within aRepoPackage.
-
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:
toStringin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(@Nullable java.lang.Object obj)- Overrides:
equalsin classjava.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.
-
-