Class StemUtility


  • public class StemUtility
    extends Object

    Created by Jeff Gaynor
    on 3/24/21 at 12:38 PM

    • Constructor Detail

      • StemUtility

        public StemUtility()
    • Method Detail

      • isStem

        public static boolean isStem​(Object o)
      • areNoneStems

        public static boolean areNoneStems​(Object... objects)
      • areAllStems

        public static boolean areAllStems​(Object... objects)
      • axisDayadRecursion

        public static void axisDayadRecursion​(QDLStem out0,
                                              QDLStem left0,
                                              QDLStem right0,
                                              int depth,
                                              boolean maxDepth,
                                              StemUtility.DyadAxisAction axisAction)
        Apply some action along an axis. This will recurse to a given axis and apply an action there
        Parameters:
        out0 -
        left0 -
        right0 -
        depth -
        maxDepth -
        axisAction -
      • formatList

        public static void formatList​(QDLStem stem)
      • main

        public static void main​(String[] args)
      • stemListToString

        public static String stemListToString​(QDLStem contents,
                                              boolean forceToString)
        Convert a stem list to a string, separated by line feeds. If forceToString is true, then every elements toString is called, otherwise, if the element is not a string, an exception is thrown.
        Parameters:
        contents -
        forceToString -
        Returns:
      • mapToStem

        public static QDLStem mapToStem​(Map map)
        Convert a generic map to a stem
        Parameters:
        map -
        Returns:
      • listToStem

        public static QDLStem listToStem​(List list)
      • convert

        protected static Object convert​(Object value)
        Converts Java objects to one of the Java objects that QDL uses.
        Parameters:
        value -
        Returns:
      • getType

        protected static int getType​(Object obj)
      • setStemValue

        public static void setStemValue​(QDLStem stem,
                                        Map<String,​Object> values)
        Floats a map of values to QDLValues in the stem. This way you don't have to mess with conversions
        Parameters:
        stem -
        values -
      • put

        public static void put​(QDLStem stem,
                               Object key,
                               Object value)
        Since Java's use of generics precludes a general QDLStem put on Objects, this utility does that.
        Parameters:
        stem -
        key -
        value -
      • convertToPOJO

        public static Object convertToPOJO​(QDLValue element,
                                           boolean escapeNames,
                                           int type)
        For use in filtering QDLValues to POJOs (plain old java object) that can be put into JSON.
        Parameters:
        element -
        escapeNames -
        type -
        Returns: