com.android.ide.common.resources.configuration
Class VersionQualifier

java.lang.Object
  extended by com.android.ide.common.resources.configuration.ResourceQualifier
      extended by com.android.ide.common.resources.configuration.VersionQualifier
All Implemented Interfaces:
java.lang.Comparable<ResourceQualifier>

public final class VersionQualifier
extends ResourceQualifier

Resource Qualifier for Platform Version.


Field Summary
static java.lang.String NAME
           
 
Constructor Summary
VersionQualifier()
           
VersionQualifier(int apiLevel)
           
 
Method Summary
 boolean checkAndSet(java.lang.String value, FolderConfiguration config)
          Check if the value is valid for this qualifier, and if so sets the value into a Folder Configuration.
 boolean equals(java.lang.Object qualifier)
          Returns true if both objects are equal.
 java.lang.String getFolderSegment()
          Returns the string used to represent this qualifier in the folder name.
static java.lang.String getFolderSegment(int version)
          Returns the folder name segment for the given value.
 java.lang.String getLongDisplayValue()
          Returns a string formatted for display purpose.
 java.lang.String getName()
          Returns the human readable name of the qualifier.
static VersionQualifier getQualifier(java.lang.String segment)
          Creates and returns a qualifier from the given folder segment.
 java.lang.String getShortDisplayValue()
          Returns a string formatted for display purpose.
 java.lang.String getShortName()
          Returns a shorter human readable name for the qualifier.
 int getVersion()
           
 boolean hasFakeValue()
          Returns whether the qualifier has a fake value.
 int hashCode()
          Returns a hash code value for the object.
 boolean isBetterMatchThan(ResourceQualifier compareTo, ResourceQualifier reference)
          Returns true if the receiver is a better match for the given reference than the given compareTo comparable.
 boolean isMatchFor(ResourceQualifier qualifier)
          Returns whether the given qualifier is a match for the receiver.
 boolean isValid()
          Returns whether the qualifier has a valid filter value.
 int since()
          Returns when this qualifier was added to Android.
 
Methods inherited from class com.android.ide.common.resources.configuration.ResourceQualifier
compareTo, deprecated, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NAME

public static final java.lang.String NAME
See Also:
Constant Field Values
Constructor Detail

VersionQualifier

public VersionQualifier(int apiLevel)

VersionQualifier

public VersionQualifier()
Method Detail

getQualifier

public static VersionQualifier getQualifier(java.lang.String segment)
Creates and returns a qualifier from the given folder segment. If the segment is incorrect, null is returned.

Parameters:
segment - the folder segment from which to create a qualifier.
Returns:
a new VersionQualifier object or null

getFolderSegment

public static java.lang.String getFolderSegment(int version)
Returns the folder name segment for the given value. This is equivalent to calling ResourceQualifier.toString() on a VersionQualifier object.

Parameters:
version - the value of the qualifier, as returned by getVersion().

getVersion

public int getVersion()

getName

public java.lang.String getName()
Description copied from class: ResourceQualifier
Returns the human readable name of the qualifier.

Specified by:
getName in class ResourceQualifier

getShortName

public java.lang.String getShortName()
Description copied from class: ResourceQualifier
Returns a shorter human readable name for the qualifier.

Specified by:
getShortName in class ResourceQualifier
See Also:
ResourceQualifier.getName()

since

public int since()
Description copied from class: ResourceQualifier
Returns when this qualifier was added to Android.

Specified by:
since in class ResourceQualifier

isValid

public boolean isValid()
Description copied from class: ResourceQualifier
Returns whether the qualifier has a valid filter value.

Specified by:
isValid in class ResourceQualifier

hasFakeValue

public boolean hasFakeValue()
Description copied from class: ResourceQualifier
Returns whether the qualifier has a fake value.

Fake values are used internally and should not be used as real qualifier value.

Specified by:
hasFakeValue in class ResourceQualifier

checkAndSet

public boolean checkAndSet(java.lang.String value,
                           FolderConfiguration config)
Description copied from class: ResourceQualifier
Check if the value is valid for this qualifier, and if so sets the value into a Folder Configuration.

Specified by:
checkAndSet in class ResourceQualifier
Parameters:
value - The value to check and set. Must not be null.
config - The folder configuration to receive the value. Must not be null.
Returns:
true if the value was valid and was set.

equals

public boolean equals(java.lang.Object qualifier)
Description copied from class: ResourceQualifier
Returns true if both objects are equal.

This is declared as abstract to force children classes to implement it.

Specified by:
equals in class ResourceQualifier

isMatchFor

public boolean isMatchFor(ResourceQualifier qualifier)
Description copied from class: ResourceQualifier
Returns whether the given qualifier is a match for the receiver.

The default implementation returns the result of ResourceQualifier.equals(Object).

Children class that re-implements this must implement ResourceQualifier.isBetterMatchThan(ResourceQualifier, ResourceQualifier) too.

Overrides:
isMatchFor in class ResourceQualifier
Parameters:
qualifier - the reference qualifier
Returns:
true if the receiver is a match.

isBetterMatchThan

public boolean isBetterMatchThan(ResourceQualifier compareTo,
                                 ResourceQualifier reference)
Description copied from class: ResourceQualifier
Returns true if the receiver is a better match for the given reference than the given compareTo comparable.

Overrides:
isBetterMatchThan in class ResourceQualifier
Parameters:
compareTo - The ResourceQualifier to compare to. Can be null, in which case the method must return true.
reference - The reference qualifier value for which the match is.
Returns:
true if the receiver is a better match.

hashCode

public int hashCode()
Description copied from class: ResourceQualifier
Returns a hash code value for the object.

This is declared as abstract to force children classes to implement it.

Specified by:
hashCode in class ResourceQualifier

getFolderSegment

public java.lang.String getFolderSegment()
Returns the string used to represent this qualifier in the folder name.

Specified by:
getFolderSegment in class ResourceQualifier

getShortDisplayValue

public java.lang.String getShortDisplayValue()
Description copied from class: ResourceQualifier
Returns a string formatted for display purpose.

Specified by:
getShortDisplayValue in class ResourceQualifier

getLongDisplayValue

public java.lang.String getLongDisplayValue()
Description copied from class: ResourceQualifier
Returns a string formatted for display purpose.

Specified by:
getLongDisplayValue in class ResourceQualifier