Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Interface java.text.AttributeSet

Subinterfaces:
MutableAttributeSet

public interface AttributeSet
extends Cloneable
This interface provides read-only access to a set of attributes. An attribute is a name/value pair, identified by name. No two attributes in a set can have the same name.

Instances of AttributeSet can be mutable through additional functions on the instance. Interfaces that accept AttributeSet generally assume that the sets may be referenced and not copied, thus callers must be careful not to subsequently mutate these sets.

Implementors must be sure to properly implement equals and hashCode, so that attribute sets may be compared and placed in hash tables. This set is equal to another set if each set is empty, or if the sets have the same number of attributes and each attribute in this set has an attribute with an equal name and value in the other set.

By definition, attributes placed in an attribute set must always be immutable, even if the set itself is not. Thus clients of AttributeSet can always take references to the names and values of attributes and rely on these not changing. The implementation of clone may also make this assumption to avoid doing a deep clone of the attributes themselves.

See Also:
AttributedCharacterIterator, MutableAttributeSet

Method Summary
Object  clone()
Return a clone of this attribute set.
boolean  contains(String attributeName, Object value)
Returns true if this set contains this attribute with an equal value, or if the value is null and the attribute is not defined.
boolean  contains(AttributeSet attributes)
Returns true if this set contains all the attributes with equal values.
Object  get(String attributeName)
Returns the value of the attribute with this name, or null if the attribute is not defined.
int  getSize()
Returns the number of attributes.
boolean  isEmpty()
Returns true if the set is empty.
Enumeration  names()
Returns an enumeration over the names of the attributes in the set.
 

Method Detail

isEmpty

public boolean isEmpty()
Returns true if the set is empty.

getSize

public int getSize()
Returns the number of attributes.

names

public Enumeration names()
Returns an enumeration over the names of the attributes in the set. The elements of the enumeration are all Strings.

get

public Object get(String attributeName)
Returns the value of the attribute with this name, or null if the attribute is not defined.

contains

public boolean contains(String attributeName,
                        Object value)
Returns true if this set contains this attribute with an equal value, or if the value is null and the attribute is not defined.

contains

public boolean contains(AttributeSet attributes)
Returns true if this set contains all the attributes with equal values.

clone

public Object clone()
Return a clone of this attribute set.
Overrides:
clone in class Object

Contents | Package | Class | Tree | Deprecated | Index | Help Java 1.2 Beta 3
PREV | NEXT SHOW LISTS | HIDE LISTS

Submit a bug or feature
Submit comments/suggestions about new javadoc look.
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road, Palo Alto, California, 94303, U.S.A. All Rights Reserved.