Class ModelElement

java.lang.Object
com.yahoo.vespa.model.builder.xml.dom.ModelElement

public class ModelElement extends Object
A w3c Element wrapper with a better API. Author unknown.
  • Constructor Details

    • ModelElement

      public ModelElement(Element xml)
  • Method Details

    • getXml

      public Element getXml()
    • child

      public ModelElement child(String name)
      Returns the child with the given name, or null if none.
    • children

      public List<ModelElement> children(String name)
      If not found, return empty list.
    • childByPath

      public ModelElement childByPath(String path)
    • childAsString

      public String childAsString(String path)
    • asString

      public String asString()
    • asDouble

      public double asDouble()
    • asLong

      public long asLong()
    • asDuration

      public Duration asDuration()
    • childAsLong

      public Long childAsLong(String path)
    • childAsInteger

      public Integer childAsInteger(String path)
    • childAsDouble

      public Double childAsDouble(String path)
    • childAsBoolean

      public Boolean childAsBoolean(String path)
    • childAsDuration

      public Duration childAsDuration(String path)
    • requiredIntegerAttribute

      public int requiredIntegerAttribute(String name)
      Returns the given attribute or throws IllegalArgumentException if not present
    • integerAttribute

      public Integer integerAttribute(String name)
      Returns the value of this attribute or null if not present
    • integerAttribute

      public Integer integerAttribute(String name, Integer defaultValue)
    • booleanAttribute

      public boolean booleanAttribute(String name)
    • booleanAttribute

      public boolean booleanAttribute(String name, boolean defaultValue)
    • longAttribute

      public Long longAttribute(String name)
    • doubleAttribute

      public Double doubleAttribute(String name)
    • requiredDoubleAttribute

      public double requiredDoubleAttribute(String name)
      Returns the given attribute or throws IllegalArgumentException if not present
    • stringAttribute

      public String stringAttribute(String name)
      Returns the content of the attribute with the given name, or null if none
    • stringAttribute

      public String stringAttribute(String name, String defaultValue)
      Returns the content of the attribute with the given name, or the default value if none
    • requiredStringAttribute

      public String requiredStringAttribute(String name)
      Returns the content of the attribute with the given name or throws IllegalArgumentException if not present
    • subElements

      public List<ModelElement> subElements(String name)
    • toString

      public String toString()
      Overrides:
      toString in class Object