com.android.sdklib.repository
Class License

java.lang.Object
  extended by com.android.sdklib.repository.License

public class License
extends java.lang.Object

License text, with an optional license XML reference.


Constructor Summary
License(java.lang.String license, java.lang.String licenseRef)
           
 
Method Summary
 boolean checkAccepted(java.io.File sdkRoot)
          Checks whether this license has previously been accepted.
 boolean equals(java.lang.Object obj)
           
 java.lang.String getLicense()
          Returns the license text.
 java.lang.String getLicenseHash()
          Returns the hash of the license text.
 java.lang.String getLicenseRef()
          Returns the license XML reference.
 int hashCode()
           
 boolean setAccepted(java.io.File sdkRoot)
          Marks this license as accepted.
 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(@NonNull
               java.lang.String license,
               @Nullable
               java.lang.String licenseRef)
Method Detail

getLicense

@NonNull
public java.lang.String getLicense()
Returns the license text. Never null.


getLicenseHash

@NonNull
public java.lang.String getLicenseHash()
Returns the hash of the license text. Never null.


getLicenseRef

@Nullable
public java.lang.String getLicenseRef()
Returns the license XML reference. Could be null, e.g. in tests or synthetic packages recreated from local source.properties.


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(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

checkAccepted

public boolean checkAccepted(@Nullable
                             java.io.File sdkRoot)
Checks whether this license has previously been accepted.

Parameters:
sdkRoot - The root directory of the Android SDK
Returns:
true if this license has already been accepted

setAccepted

public boolean setAccepted(@Nullable
                           java.io.File sdkRoot)
Marks this license as accepted.

Parameters:
sdkRoot - The root directory of the Android SDK
Returns:
true if the acceptance was persisted successfully.