FileDocCategorySizeDatePackage
PlatformTarget.javaAPI DocAndroid 1.5 API7350Wed May 06 22:41:10 BST 2009com.android.sdklib

PlatformTarget

public final class PlatformTarget extends Object implements IAndroidTarget
Represents a platform target in the SDK.

Fields Summary
private static final String
PLATFORM_HASH
String used to get a hash to the platform target
private static final String
PLATFORM_VENDOR
private static final String
PLATFORM_NAME
private final String
mLocation
private final String
mName
private final int
mApiVersionNumber
private final String
mApiVersionName
private final Map
mProperties
private final Map
mPaths
private String[]
mSkins
Constructors Summary
PlatformTarget(String location, Map properties, int apiNumber, String apiName)

    
        
                
        mName = String.format(PLATFORM_NAME, apiName);
        if (location.endsWith(File.separator) == false) {
            location = location + File.separator;
        }
        mLocation = location;
        mProperties = Collections.unmodifiableMap(properties);
        mApiVersionNumber = apiNumber;
        mApiVersionName = apiName;
        
        // pre-build the path to the platform components
        mPaths.put(ANDROID_JAR, mLocation + SdkConstants.FN_FRAMEWORK_LIBRARY);
        mPaths.put(SOURCES, mLocation + SdkConstants.FD_ANDROID_SOURCES);
        mPaths.put(ANDROID_AIDL, mLocation + SdkConstants.FN_FRAMEWORK_AIDL);
        mPaths.put(IMAGES, mLocation + SdkConstants.OS_IMAGES_FOLDER);
        mPaths.put(SAMPLES, mLocation + SdkConstants.OS_PLATFORM_SAMPLES_FOLDER);
        mPaths.put(SKINS, mLocation + SdkConstants.OS_SKINS_FOLDER);
        mPaths.put(TEMPLATES, mLocation + SdkConstants.OS_PLATFORM_TEMPLATES_FOLDER);
        mPaths.put(DATA, mLocation + SdkConstants.OS_PLATFORM_DATA_FOLDER);
        mPaths.put(ATTRIBUTES, mLocation + SdkConstants.OS_PLATFORM_ATTRS_XML);
        mPaths.put(MANIFEST_ATTRIBUTES, mLocation + SdkConstants.OS_PLATFORM_ATTRS_MANIFEST_XML);
        mPaths.put(RESOURCES, mLocation + SdkConstants.OS_PLATFORM_RESOURCES_FOLDER);
        mPaths.put(FONTS, mLocation + SdkConstants.OS_PLATFORM_FONTS_FOLDER);
        mPaths.put(LAYOUT_LIB, mLocation + SdkConstants.OS_PLATFORM_DATA_FOLDER +
                SdkConstants.FN_LAYOUTLIB_JAR);
        mPaths.put(WIDGETS, mLocation + SdkConstants.OS_PLATFORM_DATA_FOLDER +
                SdkConstants.FN_WIDGETS);
        mPaths.put(ACTIONS_ACTIVITY, mLocation + SdkConstants.OS_PLATFORM_DATA_FOLDER +
                SdkConstants.FN_INTENT_ACTIONS_ACTIVITY);
        mPaths.put(ACTIONS_BROADCAST, mLocation + SdkConstants.OS_PLATFORM_DATA_FOLDER +
                SdkConstants.FN_INTENT_ACTIONS_BROADCAST);
        mPaths.put(ACTIONS_SERVICE, mLocation + SdkConstants.OS_PLATFORM_DATA_FOLDER +
                SdkConstants.FN_INTENT_ACTIONS_SERVICE);
        mPaths.put(CATEGORIES, mLocation + SdkConstants.OS_PLATFORM_DATA_FOLDER +
                SdkConstants.FN_INTENT_CATEGORIES);
        mPaths.put(AAPT, mLocation + SdkConstants.OS_SDK_TOOLS_FOLDER + SdkConstants.FN_AAPT);
        mPaths.put(AIDL, mLocation + SdkConstants.OS_SDK_TOOLS_FOLDER + SdkConstants.FN_AIDL);
        mPaths.put(DX, mLocation + SdkConstants.OS_SDK_TOOLS_FOLDER + SdkConstants.FN_DX);
        mPaths.put(DX_JAR, mLocation + SdkConstants.OS_SDK_TOOLS_LIB_FOLDER +
                SdkConstants.FN_DX_JAR);
    
Methods Summary
public intcompareTo(IAndroidTarget target)

        if (target.isPlatform() == false) {
            return -1;
        }

        return mApiVersionNumber - target.getApiVersionNumber();
    
public booleanequals(java.lang.Object obj)

        if (obj instanceof PlatformTarget) {
            return mApiVersionNumber == ((PlatformTarget)obj).mApiVersionNumber;
        }
        
        return super.equals(obj);
    
public java.lang.StringgetApiVersionName()

        return mApiVersionName;
    
public intgetApiVersionNumber()

        return mApiVersionNumber;
    
public java.lang.StringgetClasspathName()

        return mName;
    
public java.lang.StringgetDefaultSkin()

        // at this time, this is the default skin for all the platform.
        return "HVGA";
    
public java.lang.StringgetDescription()

        return String.format("Standard Android platform %s", mApiVersionName);
    
public java.lang.StringgetFullName()

        return mName;
    
public java.lang.StringgetLocation()

        return mLocation;
    
public java.lang.StringgetName()

        return mName;
    
public IOptionalLibrary[]getOptionalLibraries()

        return null;
    
public IAndroidTargetgetParent()

        return null;
    
public java.lang.StringgetPath(int pathId)

        return mPaths.get(pathId);
    
public java.util.MapgetProperties()

        return mProperties; // mProperties is unmodifiable.
    
public java.lang.StringgetProperty(java.lang.String name)

        return mProperties.get(name);
    
public java.lang.String[]getSkins()

        return mSkins;
    
public java.lang.StringgetVendor()

        return PLATFORM_VENDOR;
    
public inthashCode()

        return hashString().hashCode();
    
public java.lang.StringhashString()

        return String.format(PLATFORM_HASH, mApiVersionNumber);
    
public booleanisCompatibleBaseFor(IAndroidTarget target)

        // basic test
        if (target == this) {
            return true;
        }

        // target is compatible wit the receiver as long as its api version number is greater or
        // equal.
        return target.getApiVersionNumber() >= mApiVersionNumber;
    
public booleanisPlatform()

        return true;
    
voidsetSkins(java.lang.String[] skins)

        mSkins = skins;