to top
Android APIs
public class

Attributes

extends Object
implements Cloneable Map<K, V>
java.lang.Object
   ↳ java.util.jar.Attributes

Class Overview

The Attributes class is used to store values for manifest entries. Attribute keys are generally instances of Attributes.Name. Values associated with attribute keys are of type String.

Summary

Nested Classes
class Attributes.Name The name part of the name/value pairs constituting an attribute as defined by the specification of the JAR manifest. 
Fields
protected Map<ObjectObject> map The Attributes as name/value pairs.
Public Constructors
Attributes()
Constructs an Attributes instance.
Attributes(Attributes attrib)
Constructs an Attributes instance obtaining keys and values from the parameter attrib.
Attributes(int size)
Constructs an Attributes instance with initial capacity of size size.
Public Methods
void clear()
Removes all key/value pairs from this Attributes.
Object clone()
Creates and returns a copy of this Object.
boolean containsKey(Object key)
Determines whether this Attributes contains the specified key.
boolean containsValue(Object value)
Determines whether this Attributes contains the specified value.
Set<Entry<ObjectObject>> entrySet()
Returns a set containing map entries for each of the key/value pair contained in this Attributes.
boolean equals(Object obj)
Determines if this Attributes and the parameter Attributes are equal.
Object get(Object key)
Returns the value associated with the parameter key.
String getValue(String name)
Returns the string associated with the parameter name.
String getValue(Attributes.Name name)
Returns the value associated with the parameter Attributes.Name key.
int hashCode()
Returns the hash code of this Attributes.
boolean isEmpty()
Determines whether this Attributes contains any keys.
Set<Object> keySet()
Returns a Set containing all the keys found in this Attributes.
Object put(Object key, Object value)
Stores key/value pairs in this Attributes.
void putAll(Map<?, ?> attrib)
Stores all the key/value pairs in the argument in this Attributes.
String putValue(String name, String val)
Stores the value val associated with the key name in this Attributes.
Object remove(Object key)
Deletes the key/value pair with key key from this Attributes.
int size()
Returns the number of key/value pairs associated with this Attributes.
Collection<Object> values()
Returns a collection of all the values present in this Attributes.
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.util.Map

Fields

protected Map<ObjectObject> map

Since: API Level 1

The Attributes as name/value pairs. Maps the attribute names (as Attributes.Name) of a JAR file manifest to arbitrary values. The attribute names thus are obtained from the Manifest for convenience.

Public Constructors

public Attributes ()

Since: API Level 1

Constructs an Attributes instance.

public Attributes (Attributes attrib)

Since: API Level 1

Constructs an Attributes instance obtaining keys and values from the parameter attrib.

Parameters
attrib The attributes to obtain entries from.

public Attributes (int size)

Since: API Level 1

Constructs an Attributes instance with initial capacity of size size.

Parameters
size Initial size of this Attributes instance.

Public Methods

public void clear ()

Since: API Level 1

Removes all key/value pairs from this Attributes.

public Object clone ()

Since: API Level 1

Creates and returns a copy of this Object. The default implementation returns a so-called "shallow" copy: It creates a new instance of the same class and then copies the field values (including object references) from this instance to the new instance. A "deep" copy, in contrast, would also recursively clone nested objects. A subclass that needs to implement this kind of cloning should call super.clone() to create the new instance and then create deep copies of the nested, mutable objects.

Returns
  • a copy of this object.

public boolean containsKey (Object key)

Since: API Level 1

Determines whether this Attributes contains the specified key.

Parameters
key The key to search for.
Returns
  • true if the key is found, false otherwise.

public boolean containsValue (Object value)

Since: API Level 1

Determines whether this Attributes contains the specified value.

Parameters
value the value to search for.
Returns
  • true if the value is found, false otherwise.

public Set<Entry<ObjectObject>> entrySet ()

Since: API Level 1

Returns a set containing map entries for each of the key/value pair contained in this Attributes.

Returns
  • a set of Map.Entry's

public boolean equals (Object obj)

Since: API Level 1

Determines if this Attributes and the parameter Attributes are equal. Two Attributes instances are equal if they contain the same keys and values.

Parameters
obj the object with which this Attributes is compared.
Returns
  • true if the Attributes are equal, false otherwise.

public Object get (Object key)

Since: API Level 1

Returns the value associated with the parameter key.

Parameters
key the key to search for.
Returns
  • Object associated with key, or null if key does not exist.

public String getValue (String name)

Since: API Level 1

Returns the string associated with the parameter name.

Parameters
name the key to obtain the value for.
Returns
  • the string associated with name, or null if name is not a valid key.

public String getValue (Attributes.Name name)

Since: API Level 1

Returns the value associated with the parameter Attributes.Name key.

Parameters
name the key to obtain the value for.
Returns
  • the String associated with name, or null if name is not a valid key.

public int hashCode ()

Since: API Level 1

Returns the hash code of this Attributes.

Returns
  • the hash code of this object.

public boolean isEmpty ()

Since: API Level 1

Determines whether this Attributes contains any keys.

Returns
  • true if one or more keys exist, false otherwise.

public Set<Object> keySet ()

Since: API Level 1

Returns a Set containing all the keys found in this Attributes.

Returns
  • a Set of all keys.

public Object put (Object key, Object value)

Since: API Level 1

Stores key/value pairs in this Attributes.

Parameters
key the key to associate with value.
value the value to store in this Attributes.
Returns
  • the value being stored.
Throws
ClassCastException when key is not an Attributes.Name or value is not a String.

public void putAll (Map<?, ?> attrib)

Since: API Level 1

Stores all the key/value pairs in the argument in this Attributes.

Parameters
attrib the associations to store (must be of type Attributes).

public String putValue (String name, String val)

Since: API Level 1

Stores the value val associated with the key name in this Attributes.

Parameters
name the key to store.
val the value to store in this Attributes.
Returns
  • the value being stored.

public Object remove (Object key)

Since: API Level 1

Deletes the key/value pair with key key from this Attributes.

Parameters
key the key to remove.
Returns
  • the values associated with the removed key, null if not present.

public int size ()

Since: API Level 1

Returns the number of key/value pairs associated with this Attributes.

Returns
  • the size of this Attributes.

public Collection<Object> values ()

Since: API Level 1

Returns a collection of all the values present in this Attributes.

Returns
  • a collection of all values present.