Class Util


  • public class Util
    extends Object
    Parsing utilities
    • Constructor Detail

      • Util

        public Util()
    • Method Detail

      • expression

        public static Expression expression​(String value,
                                            Factory factory)
        Parses an expression from its string representation.
      • splitConcatenates

        public static List<Expression> splitConcatenates​(Expression expr)
        Splits an Expression into a list of expressions by removing ConcatenateFunction and FilterFunction_strConcat Functions, and listing the children of those functions. This is applied recursively, so nested Expressions are also handled. Null-valued or empty Literal Expressions are removed.
        Returns:
        List of expressions, containing no concatenate functions
      • expression

        public static Expression expression​(String value,
                                            boolean safe,
                                            Factory factory)
        Parses an expression from its string representation.

        The safe parameter when set to true will cause null to be returned when the string can not be parsed as a ECQL expression. When false it will result in an exception thrown back.

        Returns:
        The parsed expression, or null if the string value was empty.
      • color

        public static Expression color​(Object value,
                                       Factory factory)
        Parses a color from string representation.
      • floatArray

        public static float[] floatArray​(String value)
        Parses a float array from a space delimited list.
      • defaultForNull

        @SafeVarargs
        @Nullable
        public static <T> T defaultForNull​(@Nullable
                                           T... options)
        Returns the first non-null parameter or null.
      • forceDefaultForNull

        @SafeVarargs
        public static <T> T forceDefaultForNull​(@Nullable
                                                T... options)
        Returns the first non-null parameter or throws NullPointerException.
      • removeExpressionBrackets

        public static String removeExpressionBrackets​(String s)
        Removes up to one set of ${ } expression brackets from a YSLD string. Escape sequences for the characters $}\ within the brackets are unescaped.
        Returns:
        s with brackets and escape sequences removed.
      • makeNumberIfPossible

        public static Object makeNumberIfPossible​(String str)
        Returns:
        A number parsed from the provided string, or the string itself if parsing failed. Also returns null if the string was null.
      • serializeColor

        public static String serializeColor​(Color c)
        Serializes a Java Color to a String representation of the format "#RRGGBB"
        Parameters:
        c - Color
        Returns:
        String representation of c
      • stripQuotes

        public static String stripQuotes​(String str)
        Returns:
        The string with quotes (') stripped from the beginning and end, or null if the string was null.
      • vendorOptions

        public static Map<String,​String> vendorOptions​(YamlMap sourceMap)
        Parse all vendor options (keys starting with 'x-')
        Parameters:
        sourceMap - YamlMap to parse
        Returns:
        A map of the vendor options