com.android.sdklib.repositoryv2.targets
Class AddonTarget

java.lang.Object
  extended by com.android.sdklib.repositoryv2.targets.AddonTarget
All Implemented Interfaces:
IAndroidTarget, java.lang.Comparable<IAndroidTarget>

public class AddonTarget
extends java.lang.Object
implements IAndroidTarget

Represents an add-on target in the SDK. An add-on extends a standard PlatformTarget.


Nested Class Summary
 
Nested classes/interfaces inherited from interface com.android.sdklib.IAndroidTarget
IAndroidTarget.OptionalLibrary
 
Field Summary
 
Fields inherited from interface com.android.sdklib.IAndroidTarget
ACTIONS_ACTIVITY, ACTIONS_BROADCAST, ACTIONS_SERVICE, ANDROID_AIDL, ANDROID_JAR, ANT, ATTRIBUTES, CATEGORIES, DATA, DOCS, FONTS, LAYOUT_LIB, MANIFEST_ATTRIBUTES, RESOURCES, SAMPLES, SKINS, SOURCES, TEMPLATES, UI_AUTOMATOR_JAR, WIDGETS
 
Constructor Summary
AddonTarget(com.android.repository.api.LocalPackage p, IAndroidTarget baseTarget, SystemImageManager sysImgMgr, com.android.repository.api.ProgressIndicator progress, com.android.repository.io.FileOp fop)
          Construct a new AddonTarget.
 
Method Summary
 boolean canRunOn(IAndroidTarget target)
          Returns whether the given target is compatible with the receiver.
 int compareTo(IAndroidTarget target)
           
 java.util.List<IAndroidTarget.OptionalLibrary> getAdditionalLibraries()
          Returns the additional libraries for this target.
 java.util.List<java.lang.String> getBootClasspath()
          Returns the boot classpath for this target.
 BuildToolInfo getBuildToolInfo()
          Returns a BuildToolInfo for backward compatibility.
 java.lang.String getClasspathName()
          Returns the name to be displayed when representing all the libraries this target contains.
 java.io.File getDefaultSkin()
          Returns the default skin folder for this target.
 java.lang.String getDescription()
          Returns the description of the target.
 java.io.File getFile(int pathId)
          Returns the path of a platform component.
 java.lang.String getFullName()
          Returns the full name of the target, possibly including vendor name.
 java.lang.String getLocation()
          Returns the target location.
 java.lang.String getName()
          Returns the name of the target.
 java.util.List<IAndroidTarget.OptionalLibrary> getOptionalLibraries()
          Returns a list of optional libraries for this target.
 IAndroidTarget getParent()
          Returns the parent target.
 java.lang.String getPath(int pathId)
          Returns the path of a platform component.
 java.lang.String[] getPlatformLibraries()
          Returns the list of libraries available for a given platform.
 java.util.Map<java.lang.String,java.lang.String> getProperties()
          Returns all the properties associated with this target.
 java.lang.String getProperty(java.lang.String name)
          Return the value of a given property for this target.
 int getRevision()
          Returns the revision number for the target.
 java.lang.String getShortClasspathName()
          Returns the name to be displayed when representing all the libraries this target contains.
 java.io.File[] getSkins()
          Returns the available skin folders for this target.
 java.lang.String getVendor()
          Returns the name of the vendor of the target.
 com.android.sdklib.AndroidVersion getVersion()
          Returns the version of the target.
 java.lang.String getVersionName()
          Returns the platform version as a readable string.
 java.lang.String hashString()
          Returns a string able to uniquely identify a target.
 boolean hasRenderingLibrary()
          Returns whether the target is able to render layouts.
 boolean isPlatform()
          Returns true if the target is a standard Android platform.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AddonTarget

public AddonTarget(@NonNull
                   com.android.repository.api.LocalPackage p,
                   @NonNull
                   IAndroidTarget baseTarget,
                   @NonNull
                   SystemImageManager sysImgMgr,
                   @NonNull
                   com.android.repository.api.ProgressIndicator progress,
                   @NonNull
                   com.android.repository.io.FileOp fop)
Construct a new AddonTarget.

Parameters:
p - The LocalPackage containing this target.
baseTarget - The IAndroidTarget on which this addon is based.
sysImgMgr - A SystemImageManager, used to find ISystemImages associated associated with this target.
progress -
fop - FileOp to use for file operations. For normal use should be FileOpUtils.create().
Method Detail

getLocation

public java.lang.String getLocation()
Description copied from interface: IAndroidTarget
Returns the target location.

Specified by:
getLocation in interface IAndroidTarget

getVendor

public java.lang.String getVendor()
Description copied from interface: IAndroidTarget
Returns the name of the vendor of the target.

Specified by:
getVendor in interface IAndroidTarget

getName

public java.lang.String getName()
Description copied from interface: IAndroidTarget
Returns the name of the target.

Specified by:
getName in interface IAndroidTarget

getFullName

public java.lang.String getFullName()
Description copied from interface: IAndroidTarget
Returns the full name of the target, possibly including vendor name.

Specified by:
getFullName in interface IAndroidTarget

getClasspathName

public java.lang.String getClasspathName()
Description copied from interface: IAndroidTarget
Returns the name to be displayed when representing all the libraries this target contains.

Specified by:
getClasspathName in interface IAndroidTarget

getShortClasspathName

public java.lang.String getShortClasspathName()
Description copied from interface: IAndroidTarget
Returns the name to be displayed when representing all the libraries this target contains.

Specified by:
getShortClasspathName in interface IAndroidTarget

getDescription

public java.lang.String getDescription()
Description copied from interface: IAndroidTarget
Returns the description of the target.

Specified by:
getDescription in interface IAndroidTarget

getVersion

@NonNull
public com.android.sdklib.AndroidVersion getVersion()
Description copied from interface: IAndroidTarget
Returns the version of the target. This is guaranteed to be non-null.

Specified by:
getVersion in interface IAndroidTarget

getVersionName

public java.lang.String getVersionName()
Description copied from interface: IAndroidTarget
Returns the platform version as a readable string.

Specified by:
getVersionName in interface IAndroidTarget

getRevision

public int getRevision()
Description copied from interface: IAndroidTarget
Returns the revision number for the target.

Specified by:
getRevision in interface IAndroidTarget

isPlatform

public boolean isPlatform()
Description copied from interface: IAndroidTarget
Returns true if the target is a standard Android platform.

Specified by:
isPlatform in interface IAndroidTarget

getParent

public IAndroidTarget getParent()
Description copied from interface: IAndroidTarget
Returns the parent target. This is likely to only be non null if IAndroidTarget.isPlatform() returns false

Specified by:
getParent in interface IAndroidTarget

getPath

public java.lang.String getPath(int pathId)
Description copied from interface: IAndroidTarget
Returns the path of a platform component.

Specified by:
getPath in interface IAndroidTarget
Parameters:
pathId - the id representing the path to return. Any of the constants defined in the IAndroidTarget interface can be used.

getFile

public java.io.File getFile(int pathId)
Description copied from interface: IAndroidTarget
Returns the path of a platform component.

This is like the legacy IAndroidTarget.getPath(int) method except it returns a File.

Specified by:
getFile in interface IAndroidTarget
Parameters:
pathId - the id representing the path to return. Any of the constants defined in the IAndroidTarget interface can be used.

getBuildToolInfo

public BuildToolInfo getBuildToolInfo()
Description copied from interface: IAndroidTarget
Returns a BuildToolInfo for backward compatibility. If an older SDK is used this will return paths located in the platform-tools, otherwise it'll return paths located in the latest build-tools.

Specified by:
getBuildToolInfo in interface IAndroidTarget
Returns:
a BuildToolInfo or null if none are available.

getBootClasspath

@NonNull
public java.util.List<java.lang.String> getBootClasspath()
Description copied from interface: IAndroidTarget
Returns the boot classpath for this target. In most case, this is similar to calling IAndroidTarget.getPath(int) with IAndroidTarget.ANDROID_JAR.

Specified by:
getBootClasspath in interface IAndroidTarget
Returns:
a non null list of the boot classpath.

getOptionalLibraries

@NonNull
public java.util.List<IAndroidTarget.OptionalLibrary> getOptionalLibraries()
Description copied from interface: IAndroidTarget
Returns a list of optional libraries for this target. These libraries are not automatically added to the classpath. Using them requires adding a uses-library entry in the manifest.

Specified by:
getOptionalLibraries in interface IAndroidTarget
Returns:
a list of libraries.
See Also:
IAndroidTarget.OptionalLibrary.getName()

getAdditionalLibraries

@NonNull
public java.util.List<IAndroidTarget.OptionalLibrary> getAdditionalLibraries()
Description copied from interface: IAndroidTarget
Returns the additional libraries for this target. These libraries are automatically added to the classpath, but using them requires adding a uses-library entry in the manifest.

Specified by:
getAdditionalLibraries in interface IAndroidTarget
Returns:
a list of libraries.
See Also:
IAndroidTarget.OptionalLibrary.getName()

hasRenderingLibrary

public boolean hasRenderingLibrary()
Description copied from interface: IAndroidTarget
Returns whether the target is able to render layouts.

Specified by:
hasRenderingLibrary in interface IAndroidTarget

getSkins

@NonNull
public java.io.File[] getSkins()
Description copied from interface: IAndroidTarget
Returns the available skin folders for this target.

To get the skin names, use File.getName().
Skins come either from:

The array can be empty but not null.

Specified by:
getSkins in interface IAndroidTarget

getDefaultSkin

@Nullable
public java.io.File getDefaultSkin()
Description copied from interface: IAndroidTarget
Returns the default skin folder for this target.

To get the skin name, use File.getName().

Specified by:
getDefaultSkin in interface IAndroidTarget

getPlatformLibraries

public java.lang.String[] getPlatformLibraries()
Description copied from interface: IAndroidTarget
Returns the list of libraries available for a given platform.

Specified by:
getPlatformLibraries in interface IAndroidTarget
Returns:
an array of libraries provided by the platform or null if there is none.

getProperty

public java.lang.String getProperty(java.lang.String name)
Description copied from interface: IAndroidTarget
Return the value of a given property for this target.

Specified by:
getProperty in interface IAndroidTarget
Returns:
the property value or null if it was not found.

getProperties

public java.util.Map<java.lang.String,java.lang.String> getProperties()
Description copied from interface: IAndroidTarget
Returns all the properties associated with this target. This can be null if the target has no properties.

Specified by:
getProperties in interface IAndroidTarget

canRunOn

public boolean canRunOn(IAndroidTarget target)
Description copied from interface: IAndroidTarget
Returns whether the given target is compatible with the receiver.

This means that a project using the receiver's target can run on the given target.
Example:

 CupcakeTarget.canRunOn(DonutTarget) == true
 
.

Specified by:
canRunOn in interface IAndroidTarget
Parameters:
target - the IAndroidTarget to test.

hashString

public java.lang.String hashString()
Description copied from interface: IAndroidTarget
Returns a string able to uniquely identify a target. Typically the target will encode information such as api level, whether it's a platform or add-on, and if it's an add-on vendor and add-on name.

See AndroidTargetHash for helper methods to manipulate hash strings.

Specified by:
hashString in interface IAndroidTarget

compareTo

public int compareTo(@NonNull
                     IAndroidTarget target)
Specified by:
compareTo in interface java.lang.Comparable<IAndroidTarget>