Class ParseUtils


  • public class ParseUtils
    extends java.lang.Object
    Utility class for parsing string parameters into values.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static @NotNull CheckBoxOption parseCheckBoxOption​(@NotNull java.lang.String name, @NotNull OptionManager optionManager)
      Parses a check box option name.
      static @NotNull java.awt.Color parseColor​(@NotNull java.lang.String name)
      Parses a color name.
      static @Nullable java.awt.Color parseColorNull​(@NotNull java.lang.String name)
      Parses a color name, optionally followed by "/<alpha>".
      static @NotNull Orientation parseOrientation​(@NotNull java.lang.String name)
      Parses an orientation value.
      static int parseStat​(@NotNull java.lang.String name)
      Parses a stat value.
      static @NotNull java.lang.String parseText​(@NotNull Args args, @NotNull java.io.LineNumberReader lnr)
      Concatenates trailing arguments into a string.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • parseStat

        public static int parseStat​(@NotNull
                                    @NotNull java.lang.String name)
                             throws java.io.IOException
        Parses a stat value.
        Parameters:
        name - the stat value to parse
        Returns:
        the stat value
        Throws:
        java.io.IOException - if the stat value does not exist
      • parseOrientation

        @NotNull
        public static @NotNull Orientation parseOrientation​(@NotNull
                                                            @NotNull java.lang.String name)
                                                     throws java.io.IOException
        Parses an orientation value.
        Parameters:
        name - the orientation value to parse
        Returns:
        the orientation
        Throws:
        java.io.IOException - if the orientation value does not exist
      • parseColor

        @NotNull
        public static @NotNull java.awt.Color parseColor​(@NotNull
                                                         @NotNull java.lang.String name)
                                                  throws java.io.IOException
        Parses a color name.
        Parameters:
        name - the color name to parse
        Returns:
        the color
        Throws:
        java.io.IOException - if the color name does not exist
      • parseColorNull

        @Nullable
        public static @Nullable java.awt.Color parseColorNull​(@NotNull
                                                              @NotNull java.lang.String name)
        Parses a color name, optionally followed by "/<alpha>".
        Parameters:
        name - the color name to parse
        Returns:
        the color or null if the color name does not exist
      • parseText

        @NotNull
        public static @NotNull java.lang.String parseText​(@NotNull
                                                          @NotNull Args args,
                                                          @NotNull
                                                          @NotNull java.io.LineNumberReader lnr)
                                                   throws java.io.IOException
        Concatenates trailing arguments into a string. If the first line is "<<EOF", all text up to the next line containing only "EOF" is appended. Comments starting with "#" are dropped.
        Parameters:
        args - the args to concatenate
        lnr - where to read additional lines from
        Returns:
        the concatenated string
        Throws:
        java.io.IOException - if reading from lnr fails
      • parseCheckBoxOption

        @NotNull
        public static @NotNull CheckBoxOption parseCheckBoxOption​(@NotNull
                                                                  @NotNull java.lang.String name,
                                                                  @NotNull
                                                                  @NotNull OptionManager optionManager)
                                                           throws java.io.IOException
        Parses a check box option name.
        Parameters:
        name - the check box option name to parse
        optionManager - the option manager to use
        Returns:
        the check box option
        Throws:
        java.io.IOException - if the check box option name does not exist