com.android.sdklib.repository.local
Class LocalPkgInfo

java.lang.Object
  extended by com.android.sdklib.repository.local.LocalPkgInfo
All Implemented Interfaces:
IDescription, IListDescription, java.lang.Comparable<LocalPkgInfo>
Direct Known Subclasses:
LocalAddonSysImgPkgInfo, LocalBuildToolPkgInfo, LocalDocPkgInfo, LocalExtraPkgInfo, LocalLLDBPkgInfo, LocalNdkPkgInfo, LocalPlatformPkgInfo, LocalPlatformToolPkgInfo, LocalSamplePkgInfo, LocalSourcePkgInfo, LocalSysImgPkgInfo, LocalToolPkgInfo

public abstract class LocalPkgInfo
extends java.lang.Object
implements IDescription, IListDescription, java.lang.Comparable<LocalPkgInfo>

Information about a locally installed package.

Local package information is retrieved via the LocalSdk object. Clients should not need to create instances of LocalPkgInfo directly. Instead please use the LocalSdk methods to parse and retrieve packages.


Constructor Summary
protected LocalPkgInfo(LocalSdk localSdk, java.io.File localDir, java.util.Properties sourceProps)
           
 
Method Summary
 int compareTo(LocalPkgInfo o)
          Comparison is solely done based on the IPkgDesc.
 void delete()
          Deletes the files in the SDK corresponding to this package.
 boolean equals(java.lang.Object obj)
          Computes object equality to this instance based on the underlying IPkgDesc but also specific local properties such a local directory, update available and actual source properties.
abstract  IPkgDesc getDesc()
          Returns the IPkgDesc describing this package.
 java.lang.String getListDescription()
          Returns a description of this package that is suitable for a list display.
 java.lang.String getLoadError()
           
 java.io.File getLocalDir()
           
 LocalSdk getLocalSdk()
           
 java.lang.String getLongDescription()
          Returns a description of the given element.
 java.lang.String getShortDescription()
          Returns a description of the given element.
 java.util.Properties getSourceProperties()
           
 int hashCode()
          Computes a hash code specific to this instance based on the underlying IPkgDesc but also specific local properties such a local directory, and actual source properties.
 boolean hasLoadError()
          A "broken" package is installed but is not fully operational.
 java.lang.String toString()
          String representation for debugging purposes.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LocalPkgInfo

protected LocalPkgInfo(@NonNull
                       LocalSdk localSdk,
                       @NonNull
                       java.io.File localDir,
                       @NonNull
                       java.util.Properties sourceProps)
Method Detail

getLocalSdk

@NonNull
public LocalSdk getLocalSdk()

getLocalDir

@NonNull
public java.io.File getLocalDir()

getSourceProperties

@NonNull
public java.util.Properties getSourceProperties()

getLoadError

@Nullable
public java.lang.String getLoadError()

getDesc

@NonNull
public abstract IPkgDesc getDesc()
Returns the IPkgDesc describing this package.


compareTo

public int compareTo(@NonNull
                     LocalPkgInfo o)
Comparison is solely done based on the IPkgDesc.

Other local attributes (local directory, source properties) are not used in the comparison. Consequently compareTo(LocalPkgInfo) does not match equals(Object) and the hashCode() properties.

Specified by:
compareTo in interface java.lang.Comparable<LocalPkgInfo>

toString

public java.lang.String toString()
String representation for debugging purposes.

Overrides:
toString in class java.lang.Object

hashCode

public int hashCode()
Computes a hash code specific to this instance based on the underlying IPkgDesc but also specific local properties such a local directory, and actual source properties.

Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Computes object equality to this instance based on the underlying IPkgDesc but also specific local properties such a local directory, update available and actual source properties. This is different from the behavior of compareTo(LocalPkgInfo) which only uses the IPkgDesc for ordering.

Overrides:
equals in class java.lang.Object

hasLoadError

public boolean hasLoadError()
A "broken" package is installed but is not fully operational.

For example an addon that lacks its underlying platform or a tool package that lacks some of its binaries or essentially files.

Operational code should generally ignore broken packages. Only the SDK Updater cares about displaying them so that they can be fixed.


getListDescription

@NonNull
public java.lang.String getListDescription()
Description copied from interface: IListDescription
Returns a description of this package that is suitable for a list display. Should not be empty. Must never be null.

Note that this is the "base" name for the package with no specific revision nor API mentioned. In contrast, IDescription.getShortDescription() should be used if you want more details such as the package revision number or the API, if applicable.

Specified by:
getListDescription in interface IListDescription

getShortDescription

public java.lang.String getShortDescription()
Description copied from interface: IDescription
Returns a description of the given element. Cannot be null.

A description is a multi-line of text, typically much more elaborate than what Object.toString() would provide.

Specified by:
getShortDescription in interface IDescription

getLongDescription

public java.lang.String getLongDescription()
Description copied from interface: IDescription
Returns a description of the given element. Cannot be null.

A description is a multi-line of text, typically much more elaborate than what Object.toString() would provide.

Specified by:
getLongDescription in interface IDescription

delete

public void delete()
Deletes the files in the SDK corresponding to this package.