de.lessvoid.xml.xpp3
Class Attributes

java.lang.Object
  extended by de.lessvoid.xml.xpp3.Attributes

public class Attributes
extends Object

XPP Attributes in a nicer form.

Author:
void

Nested Class Summary
 class Attributes.Entry
           
 
Constructor Summary
Attributes()
           
Attributes(Attributes source)
          copy constructor.
Attributes(String... values)
           
Attributes(org.xmlpull.v1.XmlPullParser xpp)
          Get Attributes from XmlParser.
 
Method Summary
 Properties createProperties()
          Create Properties instance from attributes.
 List<Attributes.Entry> extractParameters()
           
 String get(String name)
          Return the attribute with the given name.
 boolean getAsBoolean(String name, boolean defaultValue)
          Get as Boolean helper.
 Color getAsColor(String name)
           
 Float getAsFloat(String name)
           
 Integer getAsInteger(String name)
           
 Integer getAsInteger(String name, int defaultValue)
           
 Map<String,String> getAttributes()
           
 String getWithDefault(String name, String defaultValue)
           
 String getWithTag(String name, String tag)
           
 boolean isSet(String name)
          Is the given attribute available.
 void merge(Attributes src)
           
 void mergeAndTag(Attributes src, String tag)
           
 void refreshFromAttributes(Attributes src)
           
 void remove(String key)
           
 void removeWithTag(String tag)
           
 void resolveParameters(Attributes attributes)
           
 void set(String name, String value)
          Set an attribute.
 String toString()
           
 void translateSpecialValues(Map<String,ResourceBundle> resourceBundle, ScreenController screenController, Properties globalProperties)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Attributes

public Attributes()

Attributes

public Attributes(String... values)

Attributes

public Attributes(org.xmlpull.v1.XmlPullParser xpp)
Get Attributes from XmlParser.

Parameters:
xpp - xpp

Attributes

public Attributes(Attributes source)
copy constructor.

Parameters:
source - source
Method Detail

translateSpecialValues

public void translateSpecialValues(Map<String,ResourceBundle> resourceBundle,
                                   ScreenController screenController,
                                   Properties globalProperties)

isSet

public boolean isSet(String name)
Is the given attribute available.

Parameters:
name - name
Returns:
true if available false otherwise

get

public String get(String name)
Return the attribute with the given name.

Parameters:
name - name of attibute
Returns:
value

getWithDefault

public String getWithDefault(String name,
                             String defaultValue)

createProperties

public Properties createProperties()
Create Properties instance from attributes.

Returns:
a filled Properties instance

getAsBoolean

public boolean getAsBoolean(String name,
                            boolean defaultValue)
Get as Boolean helper.

Parameters:
name - name of attribute
defaultValue - default value
Returns:
boolen value

getAsInteger

public Integer getAsInteger(String name)

getAsInteger

public Integer getAsInteger(String name,
                            int defaultValue)

getAsFloat

public Float getAsFloat(String name)

getAsColor

public Color getAsColor(String name)

set

public void set(String name,
                String value)
Set an attribute.

Parameters:
name - name of the attribute to set
value - value to set attribute to

merge

public void merge(Attributes src)

mergeAndTag

public void mergeAndTag(Attributes src,
                        String tag)

refreshFromAttributes

public void refreshFromAttributes(Attributes src)

toString

public String toString()
Overrides:
toString in class Object

extractParameters

public List<Attributes.Entry> extractParameters()

getAttributes

public Map<String,String> getAttributes()

remove

public void remove(String key)

getWithTag

public String getWithTag(String name,
                         String tag)

resolveParameters

public void resolveParameters(Attributes attributes)

removeWithTag

public void removeWithTag(String tag)


Copyright © 2012. All Rights Reserved.