Build 1.0_r1(from source)

java.util.jar
Class Attributes

java.lang.Object
  extended by java.util.jar.Attributes
All Implemented Interfaces:
Cloneable, Map<Object,Object>

public class Attributes
extends Object
implements Cloneable, Map<Object,Object>

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


Nested Class Summary
static class Attributes.Name
           
 
Nested classes/interfaces inherited from interface java.util.Map
Map.Entry<K,V>
 
Field Summary
protected  Map<Object,Object> map
           
 
Constructor Summary
Attributes()
          Constructs an Attributes instance
Attributes(Attributes attrib)
          Constructs an Attributes instance obtaining keys and values from the parameter Attributes, attrib
Attributes(int size)
          Constructs an Attributes instance with initial capacity of size size
 
Method Summary
 void clear()
          Removes all key/value pairs from this Attributes.
 Object clone()
          Returns a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.
 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<Map.Entry<Object,Object>> entrySet()
          Returns a set containing MapEntry's for each of the key/value pairs 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(Attributes.Name name)
          Returns the value associated with the parameter Attributes.Name key.
 String getValue(String name)
          Returns the String associated with the parameter name.
 int hashCode()
          Returns the hashCode 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)
          Store value in this Attributes and associate it with key.
 void putAll(Map<?,?> attrib)
          Store all the key.value pairs in the argument in this Attributes.
 String putValue(String name, String val)
          Stores value val against 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.
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

map

protected Map<Object,Object> map
Constructor Detail

Attributes

public Attributes()
Constructs an Attributes instance


Attributes

public Attributes(Attributes attrib)
Constructs an Attributes instance obtaining keys and values from the parameter Attributes, attrib

Parameters:
attrib - The Attributes to obtain entries from.

Attributes

public Attributes(int size)
Constructs an Attributes instance with initial capacity of size size

Parameters:
size - Initial size of this Attributes instance.
Method Detail

clear

public void clear()
Removes all key/value pairs from this Attributes.

Specified by:
clear in interface Map<Object,Object>
See Also:
Map.isEmpty(), Map.size()

containsKey

public boolean containsKey(Object key)
Determines whether this Attributes contains the specified key

Specified by:
containsKey in interface Map<Object,Object>
Parameters:
key - The key to search for.
Returns:
true if the key is found, false otherwise

containsValue

public boolean containsValue(Object value)
Determines whether this Attributes contains the specified value

Specified by:
containsValue in interface Map<Object,Object>
Parameters:
value - The value to search for.
Returns:
true if the value is found, false otherwise

entrySet

public Set<Map.Entry<Object,Object>> entrySet()
Returns a set containing MapEntry's for each of the key/value pairs contained in this Attributes.

Specified by:
entrySet in interface Map<Object,Object>
Returns:
a set of MapEntry's

get

public Object get(Object key)
Returns the value associated with the parameter key

Specified by:
get in interface Map<Object,Object>
Parameters:
key - The key to search for.
Returns:
Object associated with key, or null if key does not exist.

isEmpty

public boolean isEmpty()
Determines whether this Attributes contains any keys

Specified by:
isEmpty in interface Map<Object,Object>
Returns:
true if one or more keys exist, false otherwise
See Also:
Map.size()

keySet

public Set<Object> keySet()
Returns a Set containing all the keys found in this Attributes.

Specified by:
keySet in interface Map<Object,Object>
Returns:
a Set of all keys

put

public Object put(Object key,
                  Object value)
Store value in this Attributes and associate it with key.

Specified by:
put in interface Map<Object,Object>
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

putAll

public void putAll(Map<?,?> attrib)
Store all the key.value pairs in the argument in this Attributes.

Specified by:
putAll in interface Map<Object,Object>
Parameters:
attrib - the associations to store (must be of type Attributes).

remove

public Object remove(Object key)
Deletes the key/value pair with key key from this Attributes.

Specified by:
remove in interface Map<Object,Object>
Parameters:
key - The key to remove
Returns:
the values associated with the removed key, null if not present.

size

public int size()
Returns the number of key.value pairs associated with this Attributes.

Specified by:
size in interface Map<Object,Object>
Returns:
the size of this Attributes

values

public Collection<Object> values()
Returns a Collection of all the values present in this Attributes.

Specified by:
values in interface Map<Object,Object>
Returns:
a Collection of all values present

clone

public Object clone()
Description copied from class: Object
Returns a new instance of the same class as the receiver, whose slots have been filled in with the values in the slots of the receiver.

Classes which wish to support cloning must specify that they implement the Cloneable interface, since the implementation checks for this.

Overrides:
clone in class Object
Returns:
Object a shallow copy of this object.

hashCode

public int hashCode()
Returns the hashCode of this Attributes

Specified by:
hashCode in interface Map<Object,Object>
Overrides:
hashCode in class Object
Returns:
the hashCode of this Object.
See Also:
Object.equals(java.lang.Object)

equals

public boolean equals(Object obj)
Determines if this Attributes and the parameter Attributes are equal. Two Attributes instances are equal if they contain the same keys and values.

Specified by:
equals in interface Map<Object,Object>
Overrides:
equals in class Object
Parameters:
obj - Object the object to compare with this object.
Returns:
true if the Attributes are equals, false otherwise
See Also:
Object.hashCode()

getValue

public String getValue(Attributes.Name name)
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

getValue

public String getValue(String name)
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

putValue

public String putValue(String name,
                       String val)
Stores value val against key name in this Attributes

Parameters:
name - The key to store against.
val - The value to store in this Attributes
Returns:
the Value being stored

Build 1.0_r1(from source)

Please submit a feedback, bug or feature