com.android.sdklib.repository.descriptors
Class PkgDescExtra

java.lang.Object
  extended by com.android.sdklib.repository.descriptors.PkgDesc
      extended by com.android.sdklib.repository.descriptors.PkgDescExtra
All Implemented Interfaces:
IPkgCapabilities, IPkgDesc, IPkgDescExtra, java.lang.Comparable<IPkgDesc>

public final class PkgDescExtra
extends PkgDesc
implements IPkgDescExtra

Implementation detail of IPkgDescExtra for extra packages.


Method Summary
static boolean compatibleVendorAndPath(IPkgDescExtra lhs, IPkgDescExtra rhs)
          Helper to computhe whether the extra path of both IPkgDescExtras are compatible with each other, which means they are either equal or are matched between existing path and the potential old paths list.
static java.lang.String[] convertOldPaths(java.lang.String oldPathsProperty)
          Helper method that converts the old_paths property string into the an old paths array.
 FullRevision getFullRevision()
          Returns the package's FullRevision or null.
 java.lang.String[] getOldPaths()
          Returns an optional list of older paths for this extra package.
 java.lang.String getPath()
          Returns the package's path string or null.
 PkgType getType()
          Returns the type of the package.
 java.lang.String getVendorId()
          Returns the package's vendor-id string or null.
 boolean isUpdateFor(IPkgDesc existingDesc)
          Indicates whether this package descriptor is an update for the given existing descriptor.
 
Methods inherited from class com.android.sdklib.repository.descriptors.PkgDesc
compareTo, equals, getAndroidVersion, getMajorRevision, getMinPlatformToolsRev, getMinToolsRev, getTag, hasAndroidVersion, hasFullRevision, hashCode, hasMajorRevision, hasMinPlatformToolsRev, hasMinToolsRev, hasPath, hasTag, hasVendorId, isGenericUpdateFor, newAddon, newAddon, newBuildTool, newDoc, newExtra, newPlatform, newPlatformTool, newSample, newSource, newSysImg, newTool, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.android.sdklib.repository.descriptors.IPkgDesc
getAndroidVersion, getMajorRevision, getMinPlatformToolsRev, getMinToolsRev, getTag
 
Methods inherited from interface java.lang.Comparable
compareTo
 
Methods inherited from interface com.android.sdklib.repository.descriptors.IPkgCapabilities
hasAndroidVersion, hasFullRevision, hasMajorRevision, hasMinPlatformToolsRev, hasMinToolsRev, hasPath, hasTag, hasVendorId
 

Method Detail

getType

@NonNull
public PkgType getType()
Description copied from interface: IPkgDesc
Returns the type of the package.

Specified by:
getType in interface IPkgDesc
Specified by:
getType in class PkgDesc
Returns:
Returns one of the PkgType constants.

getFullRevision

@NonNull
public FullRevision getFullRevision()
Description copied from interface: IPkgDesc
Returns the package's FullRevision or null.

Specified by:
getFullRevision in interface IPkgDesc
Overrides:
getFullRevision in class PkgDesc
Returns:
A non-null value if IPkgCapabilities.hasFullRevision() is true; otherwise a null value.

getPath

@NonNull
public java.lang.String getPath()
Description copied from interface: IPkgDesc
Returns the package's path string or null.

For PkgType.PKG_SYS_IMAGES, the path is the system-image ABI.
For PkgType.PKG_PLATFORMS, the path is the platform hash string.
For PkgType.PKG_ADDONS, the path is the platform hash string.
For PkgType.PKG_EXTRAS, the path is the extra-path string.

Specified by:
getPath in interface IPkgDesc
Overrides:
getPath in class PkgDesc
Returns:
A non-null value if IPkgCapabilities.hasPath() is true; otherwise a null value.

getOldPaths

@NonNull
public java.lang.String[] getOldPaths()
Description copied from interface: IPkgDescExtra
Returns an optional list of older paths for this extra package.

Specified by:
getOldPaths in interface IPkgDescExtra
Returns:
A non-null, possibly empty, for old paths previously used for the same extra.

getVendorId

@NonNull
public java.lang.String getVendorId()
Description copied from interface: IPkgDesc
Returns the package's vendor-id string or null.

Specified by:
getVendorId in interface IPkgDesc
Overrides:
getVendorId in class PkgDesc
Returns:
A non-null value if IPkgCapabilities.hasVendorId() is true; otherwise a null value.

isUpdateFor

public boolean isUpdateFor(@NonNull
                           IPkgDesc existingDesc)
Description copied from interface: IPkgDesc
Indicates whether this package descriptor is an update for the given existing descriptor.

Specified by:
isUpdateFor in interface IPkgDesc
Parameters:
existingDesc - A non-null existing descriptor.
Returns:
True if this package is an update for the given one.

convertOldPaths

@NonNull
public static java.lang.String[] convertOldPaths(@Nullable
                                                         java.lang.String oldPathsProperty)
Helper method that converts the old_paths property string into the an old paths array.

Parameters:
oldPathsProperty - A possibly-null old_path property string.
Returns:
A list of old paths split by their separator. Can be empty but not null.

compatibleVendorAndPath

public static boolean compatibleVendorAndPath(@NonNull
                                              IPkgDescExtra lhs,
                                              @NonNull
                                              IPkgDescExtra rhs)
Helper to computhe whether the extra path of both IPkgDescExtras are compatible with each other, which means they are either equal or are matched between existing path and the potential old paths list.

This also covers backward compatibility -- in earlier schemas the vendor id was merged into the path string when reloading installed extras.

Parameters:
lhs - A non-null IPkgDescExtra.
rhs - Another non-null IPkgDescExtra.
Returns:
true if the paths are compatible.