FileDocCategorySizeDatePackage
NameValuePair.javaAPI DocAndroid 1.5 API2891Wed May 06 22:41:02 BST 2009com.android.dx.rop.annotation

NameValuePair

public final class NameValuePair extends Object implements Comparable
A (name, value) pair. These are used as the contents of an annotation.

Fields Summary
private final com.android.dx.rop.cst.CstUtf8
name
non-null; the name
private final com.android.dx.rop.cst.Constant
value
non-null; the value
Constructors Summary
public NameValuePair(com.android.dx.rop.cst.CstUtf8 name, com.android.dx.rop.cst.Constant value)
Construct an instance.

param
name non-null; the name
param
value non-null; the value

        if (name == null) {
            throw new NullPointerException("name == null");
        }

        if (value == null) {
            throw new NullPointerException("value == null");
        }

        // Reject CstUtf8 values. (They should be CstStrings.)
        if (value instanceof CstUtf8) {
            throw new IllegalArgumentException("bad value: " + value);
        }
        
        this.name = name;
        this.value = value;
    
Methods Summary
public intcompareTo(com.android.dx.rop.annotation.NameValuePair other)
{@inheritDoc}

Instances of this class compare in name-major and value-minor order.

        int result = name.compareTo(other.name);

        if (result != 0) {
            return result;
        }

        return value.compareTo(other.value);
    
public booleanequals(java.lang.Object other)
{@inheritDoc}

        if (! (other instanceof NameValuePair)) {
            return false;
        }

        NameValuePair otherPair = (NameValuePair) other;

        return name.equals(otherPair.name)
            && value.equals(otherPair.value);
    
public com.android.dx.rop.cst.CstUtf8getName()
Gets the name.

return
non-null; the name

        return name;
    
public com.android.dx.rop.cst.ConstantgetValue()
Gets the value.

return
non-null; the valute

        return value;
    
public inthashCode()
{@inheritDoc}

        return name.hashCode() * 31 + value.hashCode();
    
public java.lang.StringtoString()
{@inheritDoc}

        return name.toHuman() + ":" + value;