Class AXmlAttribute<T>

java.lang.Object
soot.jimple.infoflow.android.axml.AXmlElement
soot.jimple.infoflow.android.axml.AXmlAttribute<T>
Type Parameters:
T - determines the attribute's type. Currently Integer, Boolean and String are supported.

public class AXmlAttribute<T> extends AXmlElement
Represents an attribute of an Android XML node.
Author:
Stefan Haas, Mario Schlipf, Steven Arzt
  • Field Details

    • name

      protected String name
      The attribute's name.
    • type

      protected int type
      The attribute's type
    • value

      protected T value
      The attribute's value.
    • resourceId

      protected int resourceId
      The attribute's resource id
  • Constructor Details

    • AXmlAttribute

      public AXmlAttribute(String name, T value, String ns)
      Creates a new AXmlAttribute object with the given name, value and namespace.
      The addded flag is defaulted to true (see AXmlElement.added).
      Parameters:
      name - the attribute's name.
      value - the attribute's value.
      ns - the attribute's namespace.
    • AXmlAttribute

      public AXmlAttribute(String name, int resourceId, T value, String ns)
      Creates a new AXmlAttribute object with the given name, value and namespace.
      The addded flag is defaulted to true (see AXmlElement.added).
      Parameters:
      name - the attribute's name.
      resourceId - the attribute's resource id.
      value - the attribute's value.
      ns - the attribute's namespace.
    • AXmlAttribute

      public AXmlAttribute(String name, int resourceId, T value, String ns, boolean added)
      Creates a new AXmlAttribute object with the given name, value and namespace.
      Parameters:
      name - the attribute's name.
      resourceId - the attribute's resource id.
      value - the attribute's value.
      ns - the attribute's namespace.
      added - wheter this attribute was part of a parsed xml file or added afterwards.
    • AXmlAttribute

      public AXmlAttribute(String name, int resourceId, int type, T value, String ns, boolean added)
      Creates a new AXmlAttribute object with the given name, type, value and namespace.
      Parameters:
      name - the attribute's name.
      resourceId - the attribute's resource id.
      type - the attribute's type
      value - the attribute's value.
      ns - the attribute's namespace.
      added - wheter this attribute was part of a parsed xml file or added afterwards.
  • Method Details

    • getName

      public String getName()
      Returns the name of this attribute.
      Returns:
      the attribute's name.
    • getResourceId

      public int getResourceId()
      Gets the resource id of this attribute.
      Returns:
      the attribute's resource id.
    • setValue

      public void setValue(T value)
      Sets the value for this attribute.
      Parameters:
      value - the new value.
    • getValue

      public T getValue()
      Returns the value of this attribute.
      Returns:
      the attribute's value.
    • getType

      public int getType()
      Returns an integer which identifies this attribute's type. Currently if AXmlAttribute is typed as Integer this will return NodeVisitor.TYPE_INT_HEX, typed Boolean will result in NodeVisitor.TYPE_INT_BOOLEAN and otherwise (even if not typed as String) this returns NodeVisitor.TYPE_STRING.
      Returns:
      integer representing the attribute's type
      See Also:
      • NodeVisitor.TYPE_INT_HEX
      • NodeVisitor.TYPE_INT_BOOLEAN
      • NodeVisitor.TYPE_STRING
    • getAttributeType

      public int getAttributeType()
      Returns an integer which identifies this attribute's type. This is the type originally passed to the constructor.
      Returns:
      integer representing the attribute's type
      See Also:
      • NodeVisitor.TYPE_INT_HEX
      • NodeVisitor.TYPE_INT_BOOLEAN
      • NodeVisitor.TYPE_STRING
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • asBoolean

      public boolean asBoolean()
      Gets this value as a Boolean. This function only looks at the immediate value and does not resolve references.
      Returns:
      This value as a Boolean.
    • asBoolean

      public boolean asBoolean(ARSCFileParser arscParser)
      Gets this value as a Boolean. If this value is a reference to a resource, a lookup is performed.
      Parameters:
      arscParser - The ARSC parser for resource lookups
      Returns:
      This value as a Boolean.
    • asString

      public String asString()
      Gets this value as a string. This function only looks at the immediate value and does not resolve references.
      Returns:
      This value as a string
    • asString

      public String asString(ARSCFileParser arscParser)
      Gets this value as a string. If this value is a reference to a resource, a lookup is performed.
      Parameters:
      arscParser - The ARSC parser for resource lookups
      Returns:
      This value as a string
    • asInteger

      public int asInteger()
      Gets this value as an integer value. This function only looks at the immediate value and does not resolve references.
      Returns:
      This value as an integer value
    • asInteger

      public int asInteger(ARSCFileParser arscParser)
      Gets this value as an integer value. If this value is a reference to a resource, a lookup is performed.
      Parameters:
      arscParser - The ARSC parser for resource lookups
      Returns:
      This value as an integer value
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object