Class SvgAttribute

java.lang.Object
pro.verron.asciidoc.converters.svg.SvgAttribute
All Implemented Interfaces:
Comparable<SvgAttribute>

public final class SvgAttribute extends Object implements Comparable<SvgAttribute>

An SVG attribute name/value pair, used when constructing SVG elements.

Instances are created via the factory method attr(String, String). The sentinel value NONE represents an absent attribute and is filtered out during serialization.

  • Field Details

    • NONE

      public static final SvgAttribute NONE
      Sentinel value representing an absent attribute; filtered out during serialization.
  • Method Details

    • attr

      public static SvgAttribute attr(String name, String value)
      Creates an attribute with a string value.
      Parameters:
      name - attribute name
      value - attribute value
      Returns:
      the new SvgAttribute
    • attr

      public static SvgAttribute attr(String name, int i)
      Creates an attribute with an integer value.
      Parameters:
      name - attribute name
      i - attribute value
      Returns:
      the new SvgAttribute
    • compareTo

      public int compareTo(SvgAttribute that)
      Specified by:
      compareTo in interface Comparable<SvgAttribute>
    • hashCode

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

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • toString

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

      public String serialize()
      Serializes this attribute as name="value".
      Returns:
      the serialized attribute string