Class SinkUtils

java.lang.Object
org.apache.maven.doxia.sink.impl.SinkUtils

public class SinkUtils extends Object
Collection of common utility methods for sinks.
Since:
1.1
Author:
ltheussl
  • Field Details

  • Method Details

    • getAttributeString

      public static String getAttributeString(AttributeSet att)
      Utility method to get an AttributeSet as a String. The resulting String is in the form ' name1="value1" name2="value2" ...', ie it can be appended directly to an xml start tag. Attribute values that are itself AttributeSets are ignored unless the Attribute name is SinkEventAttributeSet.STYLE, in which case they are written as outlined at SinkEventAttributes.STYLE. All other keys and values are written as Strings.
      Parameters:
      att - The AttributeSet. May be null, in which case an empty String is returned.
      Returns:
      the AttributeSet as a String in a form that can be appended to an xml start tag.
    • asCssString

      public static String asCssString(AttributeSet att)
    • asCssDeclaration

      public static String asCssDeclaration(String property, String value)
    • filterAttributes

      public static SinkEventAttributes filterAttributes(AttributeSet attributes, String[] valids)
      Filters the given AttributeSet. Removes all attributes whose name (key) is not contained in the sorted array valids.
      Parameters:
      attributes - The AttributeSet to filter. The String values of Attribute names are compared to the elements of the valids array.
      valids - a sorted array of attribute names that are to be kept in the resulting AttributeSet. Note: a binary search is employed, so the array has to be sorted for correct results.
      Returns:
      A filtered SinkEventAttributes object. Returns null if the input AttributeSet is null. If the array of valids is either null or empty, an empty AttributeSet is returned.