com.android.sdklib.repositoryv2.targets
Class PlatformTarget

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

public class PlatformTarget
extends java.lang.Object
implements IAndroidTarget

Represents a platform target in the SDK.


Nested Class Summary
static class PlatformTarget.Library
          Simple struct used by Gson when parsing the library file.
 
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
PlatformTarget(com.android.repository.api.LocalPackage p, AndroidSdkHandler sdkHandler, com.android.repository.io.FileOp fop, com.android.repository.api.ProgressIndicator progress)
          Construct a new PlatformTarget based on the given package.
 
Method Summary
 boolean canRunOn(IAndroidTarget target)
          Returns whether the given target is compatible with the receiver.
 int compareTo(IAndroidTarget o)
           
 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.
 ISystemImage getSystemImage(IdDisplay tag, java.lang.String abiType)
          Returns the system image information for the given tag and abiType.
 ISystemImage[] getSystemImages()
          Returns an array of system images for this target.
 java.lang.String getVendor()
          Returns the name of the vendor of the target.
 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

PlatformTarget

public PlatformTarget(@NonNull
                      com.android.repository.api.LocalPackage p,
                      @NonNull
                      AndroidSdkHandler sdkHandler,
                      @NonNull
                      com.android.repository.io.FileOp fop,
                      @NonNull
                      com.android.repository.api.ProgressIndicator progress)
Construct a new PlatformTarget based on the given package.

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()
Returns the name of the vendor of the target. For platform, this is always PLATFORM_VENDOR

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

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 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

@NonNull
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

@NonNull
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

@Nullable
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

@NonNull
public java.lang.String[] getPlatformLibraries()
Returns the list of libraries available for a given platform. For platforms this is always SdkConstants.ANDROID_TEST_RUNNER_LIB.

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

getProperty

@Nullable
public java.lang.String getProperty(@NonNull
                                             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

@Nullable
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

getSystemImages

@NonNull
public ISystemImage[] getSystemImages()
Description copied from interface: IAndroidTarget
Returns an array of system images for this target. The array can be empty but not null.

Specified by:
getSystemImages in interface IAndroidTarget

getShortClasspathName

@NonNull
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

getClasspathName

@NonNull
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

getSystemImage

@Nullable
public ISystemImage getSystemImage(@NonNull
                                            IdDisplay tag,
                                            @NonNull
                                            java.lang.String abiType)
Description copied from interface: IAndroidTarget
Returns the system image information for the given tag and abiType.

Specified by:
getSystemImage in interface IAndroidTarget
Parameters:
tag - A tag id-display.
abiType - An ABI type string.
Returns:
An existing ISystemImage for the requested abiType or null if none exists for this type.

canRunOn

public boolean canRunOn(@NonNull
                        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

@NonNull
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 o)
Specified by:
compareTo in interface java.lang.Comparable<IAndroidTarget>