com.android.repository.api
Class License

java.lang.Object
  extended by com.android.repository.api.License
Direct Known Subclasses:
LicenseType

public abstract class License
extends java.lang.Object

License text, with an optional license XML reference.


Constructor Summary
License()
           
 
Method Summary
 boolean checkAccepted(java.io.File repositoryRoot)
          Checks whether this license has previously been accepted.
 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.io.File 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
 

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.io.File 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.io.File repositoryRoot)
Marks this license as accepted.

Parameters:
repositoryRoot - The root directory of the repository
Returns:
true if the acceptance was persisted successfully.