Attributes
open class Attributes : Cloneable, MutableMap<Any!, Any!>
kotlin.Any | |
↳ | java.util.jar.Attributes |
The Attributes class maps Manifest attribute names to associated string values. Valid attribute names are case-insensitive, are restricted to the ASCII characters in the set [0-9a-zA-Z_-], and cannot exceed 70 characters in length. There must be a colon and a SPACE after the name; the combined length will not exceed 72 characters. Attribute values can contain any characters and will be UTF8-encoded when written to the output stream. See the JAR File Specification for more information about valid attribute names and values.
This map and its views have a predictable iteration order, namely the order that keys were inserted into the map, as with LinkedHashMap
.
Summary
Nested classes | |
---|---|
open | The Attributes. |
Public constructors | |
---|---|
Constructs a new, empty Attributes object with default size. | |
Attributes(size: Int) Constructs a new, empty Attributes object with the specified initial size. | |
Attributes(attr: Attributes!) Constructs a new Attributes object with the same attribute name-value mappings as in the specified Attributes. |
Public methods | |
---|---|
open Unit | clear() Removes all attributes from this Map. |
open Any | clone() Returns a copy of the Attributes, implemented as follows: public Object clone() { return new Attributes(this); } |
open Boolean | containsKey(key: Any!) Returns true if this Map contains the specified attribute name (key). |
open Boolean | containsValue(value: Any!) Returns true if this Map maps one or more attribute names (keys) to the specified value. |
open Boolean | Compares the specified object to the underlying map for equality. |
open Any? | Returns the value of the specified attribute name, or null if the attribute name was not found. |
open String! | Returns the value of the specified attribute name, specified as a string, or null if the attribute was not found. |
open String! | getValue(name: Attributes.Name!) Returns the value of the specified Attributes. |
open Int | hashCode() Returns the hash code value for this Map. |
open Boolean | isEmpty() Returns true if this Map contains no attributes. |
open Any? | Associates the specified value with the specified attribute name (key) in this Map. |
open Unit | Copies all of the attribute name-value mappings from the specified Attributes to this Map. |
open String! | Associates the specified value with the specified attribute name, specified as a String. |
open Any? | Removes the attribute with the specified name (key) from this Map. |
Properties | |
---|---|
open MutableSet<MutableEntry<Any!, Any!>> | Returns a Collection view of the attribute name-value mappings contained in this Map. |
open MutableSet<Any!> | Returns a Set view of the attribute names (keys) contained in this Map. |
MutableMap<Any!, Any!>! | The attribute name-value mappings. |
open Int | Returns the number of attributes in this Map. |
open MutableCollection<Any!> | Returns a Collection view of the attribute values contained in this Map. |
Public constructors
Attributes
Attributes()
Constructs a new, empty Attributes object with default size.
Attributes
Attributes(size: Int)
Constructs a new, empty Attributes object with the specified initial size.
Parameters | |
---|---|
size | Int: the initial number of attributes |
Attributes
Attributes(attr: Attributes!)
Constructs a new Attributes object with the same attribute name-value mappings as in the specified Attributes.
Parameters | |
---|---|
attr | Attributes!: the specified Attributes |
Public methods
clear
open fun clear(): Unit
Removes all attributes from this Map.
Exceptions | |
---|---|
java.lang.UnsupportedOperationException | if the clear operation is not supported by this map |
clone
open fun clone(): Any
Returns a copy of the Attributes, implemented as follows:
public Object clone() { return new Attributes(this); }
Return | |
---|---|
Any | a clone of this instance. |
Exceptions | |
---|---|
java.lang.CloneNotSupportedException | if the object's class does not support the Cloneable interface. Subclasses that override the clone method can also throw this exception to indicate that an instance cannot be cloned. |
containsKey
open fun containsKey(key: Any!): Boolean
Returns true if this Map contains the specified attribute name (key).
Parameters | |
---|---|
key | Any!: key whose presence in this map is to be tested |
name | the attribute name |
Return | |
---|---|
Boolean | true if this Map contains the specified attribute name |
Exceptions | |
---|---|
java.lang.ClassCastException | if the key is of an inappropriate type for this map (java.util.Collection#) |
java.lang.NullPointerException | if the specified key is null and this map does not permit null keys (java.util.Collection#) |
containsValue
open fun containsValue(value: Any!): Boolean
Returns true if this Map maps one or more attribute names (keys) to the specified value.
Parameters | |
---|---|
value | Any!: the attribute value |
Return | |
---|---|
Boolean | true if this Map maps one or more attribute names to the specified value |
Exceptions | |
---|---|
java.lang.ClassCastException | if the value is of an inappropriate type for this map (java.util.Collection#) |
java.lang.NullPointerException | if the specified value is null and this map does not permit null values (java.util.Collection#) |
equals
open fun equals(other: Any?): Boolean
Compares the specified object to the underlying map for equality. Returns true if the given object is also a Map and the two maps represent the same mappings.
Parameters | |
---|---|
obj | the reference object with which to compare. |
o | the Object to be compared |
Return | |
---|---|
Boolean | true if the specified Object is equal to this Map |
get
open fun get(key: Any!): Any?
Returns the value of the specified attribute name, or null if the attribute name was not found.
Parameters | |
---|---|
key | Any!: the key whose associated value is to be returned |
name | the attribute name |
Return | |
---|---|
Any? | the value of the specified attribute name, or null if not found. |
Exceptions | |
---|---|
java.lang.ClassCastException | if the key is of an inappropriate type for this map (java.util.Collection#) |
java.lang.NullPointerException | if the specified key is null and this map does not permit null keys (java.util.Collection#) |
getValue
open fun getValue(name: String!): String!
Returns the value of the specified attribute name, specified as a string, or null if the attribute was not found. The attribute name is case-insensitive.
This method is defined as:
return (String)get(new Attributes.Name((String)name));
Parameters | |
---|---|
name | String!: the attribute name as a string |
Return | |
---|---|
String! | the String value of the specified attribute name, or null if not found. |
Exceptions | |
---|---|
java.lang.IllegalArgumentException | if the attribute name is invalid |
getValue
open fun getValue(name: Attributes.Name!): String!
Returns the value of the specified Attributes.Name, or null if the attribute was not found.
This method is defined as:
return (String)get(name);
Parameters | |
---|---|
name | Attributes.Name!: the Attributes.Name object |
Return | |
---|---|
String! | the String value of the specified Attribute.Name, or null if not found. |
hashCode
open fun hashCode(): Int
Returns the hash code value for this Map.
Return | |
---|---|
Int | the hash code value for this map |
isEmpty
open fun isEmpty(): Boolean
Returns true if this Map contains no attributes.
Return | |
---|---|
Boolean | true if this map contains no key-value mappings |
put
open fun put(
key: Any!,
value: Any!
): Any?
Associates the specified value with the specified attribute name (key) in this Map. If the Map previously contained a mapping for the attribute name, the old value is replaced.
Parameters | |
---|---|
key | Any!: key with which the specified value is to be associated |
value | Any!: the attribute value |
name | the attribute name |
Return | |
---|---|
Any? | the previous value of the attribute, or null if none |
Exceptions | |
---|---|
java.lang.UnsupportedOperationException | if the put operation is not supported by this map |
java.lang.ClassCastException | if the name is not a Attributes.Name or the value is not a String |
java.lang.NullPointerException | if the specified key or value is null and this map does not permit null keys or values |
java.lang.IllegalArgumentException | if some property of the specified key or value prevents it from being stored in this map |
putAll
open fun putAll(from: Map<*, *>): Unit
Copies all of the attribute name-value mappings from the specified Attributes to this Map. Duplicate mappings will be replaced.
Parameters | |
---|---|
m | mappings to be stored in this map |
attr | the Attributes to be stored in this map |
Exceptions | |
---|---|
java.lang.UnsupportedOperationException | if the putAll operation is not supported by this map |
java.lang.ClassCastException | if attr is not an Attributes |
java.lang.NullPointerException | if the specified map is null, or if this map does not permit null keys or values, and the specified map contains null keys or values |
java.lang.IllegalArgumentException | if some property of a key or value in the specified map prevents it from being stored in this map |
putValue
open fun putValue(
name: String!,
value: String!
): String!
Associates the specified value with the specified attribute name, specified as a String. The attributes name is case-insensitive. If the Map previously contained a mapping for the attribute name, the old value is replaced.
This method is defined as:
return (String)put(new Attributes.Name(name), value);
Parameters | |
---|---|
name | String!: the attribute name as a string |
value | String!: the attribute value |
Return | |
---|---|
String! | the previous value of the attribute, or null if none |
Exceptions | |
---|---|
java.lang.IllegalArgumentException | if the attribute name is invalid |
remove
open fun remove(key: Any!): Any?
Removes the attribute with the specified name (key) from this Map. Returns the previous attribute value, or null if none.
Parameters | |
---|---|
key | Any!: key whose mapping is to be removed from the map |
name | attribute name |
Return | |
---|---|
Any? | the previous value of the attribute, or null if none |
Exceptions | |
---|---|
java.lang.UnsupportedOperationException | if the remove operation is not supported by this map |
java.lang.ClassCastException | if the key is of an inappropriate type for this map (java.util.Collection#) |
java.lang.NullPointerException | if the specified key is null and this map does not permit null keys (java.util.Collection#) |
Properties
entries
open val entries: MutableSet<MutableEntry<Any!, Any!>>
Returns a Collection view of the attribute name-value mappings contained in this Map.
Return | |
---|---|
MutableSet<MutableEntry<Any!, Any!>> | a set view of the mappings contained in this map |
keys
open val keys: MutableSet<Any!>
Returns a Set view of the attribute names (keys) contained in this Map.
Return | |
---|---|
MutableSet<Any!> | a set view of the keys contained in this map |
map
protected var map: MutableMap<Any!, Any!>!
The attribute name-value mappings.
size
open val size: Int
Returns the number of attributes in this Map.
Return | |
---|---|
Int | the number of key-value mappings in this map |
values
open val values: MutableCollection<Any!>
Returns a Collection view of the attribute values contained in this Map.
Return | |
---|---|
MutableCollection<Any!> | a collection view of the values contained in this map |