Package eu.simuline.util.sgml
Class AttributesImpl
- java.lang.Object
-
- eu.simuline.util.sgml.AttributesImpl
-
- All Implemented Interfaces:
Attributes
public final class AttributesImpl extends Object implements Attributes
An **** partial **** implementation of the SAX-interfaceAttributeswhich allows attributes without values usingNO_VALUE.- Version:
- 1.0
- Author:
- Ernst Reissner
-
-
Field Summary
Fields Modifier and Type Field Description private ListMap<String,String>name2valueMaps the name of an attribute to its value.static StringNO_VALUEUsed as a value inname2valueto signify that the corresponding attribute has no value.
-
Constructor Summary
Constructors Constructor Description AttributesImpl(ListMap<String,String> name2value)Creates a new emptyAttributesImplwhich represents the given attribute list.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intgetIndex(String qName)intgetIndex(String uri, String localPart)intgetLength()StringgetLocalName(int index)StringgetQName(int index)StringgetType(int index)StringgetType(String qName)StringgetType(String uri, String localName)StringgetURI(int index)StringgetValue(int index)StringgetValue(String qName)StringgetValue(String uri, String localName)private static StringnoValueToNull(Object valueOrNot)AttributesImpltoLowerCase()StringtoString()
-
-
-
Field Detail
-
NO_VALUE
public static final String NO_VALUE
Used as a value inname2valueto signify that the corresponding attribute has no value. This is much better than simply unsingnull. The latter would not allow to rule out a multiple attribute without a value.
-
-
Constructor Detail
-
AttributesImpl
AttributesImpl(ListMap<String,String> name2value)
Creates a new emptyAttributesImplwhich represents the given attribute list.- Parameters:
name2value- aListMaprepresenting an attribute list, as specified forname2value.
-
-
Method Detail
-
noValueToNull
private static String noValueToNull(Object valueOrNot)
- Parameters:
valueOrNot- aStringor the objectNO_VALUE.- Returns:
- a
Stringwhich is-
nullforvalueOrNot == NO_VALUE. -
valueOrNotitself casted to a string otherwise.
-
-
getLength
public int getLength()
- Specified by:
getLengthin interfaceAttributes
-
getURI
public String getURI(int index)
- Specified by:
getURIin interfaceAttributes
-
getLocalName
public String getLocalName(int index)
- Specified by:
getLocalNamein interfaceAttributes
-
getQName
public String getQName(int index)
- Specified by:
getQNamein interfaceAttributes
-
getType
public String getType(int index)
- Specified by:
getTypein interfaceAttributes
-
getValue
public String getValue(int index)
- Specified by:
getValuein interfaceAttributes
-
getIndex
public int getIndex(String uri, String localPart)
- Specified by:
getIndexin interfaceAttributes
-
getIndex
public int getIndex(String qName)
- Specified by:
getIndexin interfaceAttributes
-
getType
public String getType(String uri, String localName)
- Specified by:
getTypein interfaceAttributes
-
getType
public String getType(String qName)
- Specified by:
getTypein interfaceAttributes
-
getValue
public String getValue(String uri, String localName)
- Specified by:
getValuein interfaceAttributes
-
getValue
public String getValue(String qName)
- Specified by:
getValuein interfaceAttributes
-
toLowerCase
public AttributesImpl toLowerCase()
-
-