Class CssValueUtil

java.lang.Object
com.webfirmframework.wffweb.util.CssValueUtil

public final class CssValueUtil extends Object
Since:
1.0.0
  • Method Details

    • addCssValuePartStartEndValue

      public void addCssValuePartStartEndValue(String start, String end)
      The given value is used by Web Firm Framework Index Based Extraction algorithm to extract css value parts, i.e. the CssValueUtil#split(String) is extracting values based on the given values.
      Eg :-
       addCssValuePartStartEndValue("rgb(", ")");
       
      And the following "rgb(", ")", "rgba(", ")", "hsl(", ")", "hsla(", ")" values are already added.
      Parameters:
      start -
      end -
      Since:
      1.0.0
    • split

      public static List<String> split(String cssValue)
      splits each cssValue part based on the css rule.
      This extraction is done based on the Web Firm Framework Index Based Extraction algorithm. It will throw InvalidValueException if the given cssValue contains no space in between any valid cssValue part, eg:- rgb(1, 2, 5)rgb(11, 12, 15). And, it doesn't validate the extracted cssValue parts so the extracted cssValue parts (i.e. the returned List<String>) may contain invalid cssValue part.

      Sample code to test
       final List<String> splitTest = CssValueUtil.split("hsla(7, 8, 9, 1) red rgb(3, 5, 6) rgb(7, 8, 9) rgba(7, 8, 9, 1) middle hsl(10, 11, 12) green   blue");
       for (final String each : splitTest) {
           System.out.println(each);
       }
      
       gives out as :
       
       hsla(7, 8, 9, 1)
       red
       rgb(3, 5, 6)
       rgb(7, 8, 9)
       rgba(7, 8, 9, 1)
       middle
       hsl(10, 11, 12)
       green
       blue
       
      Parameters:
      cssValue - the value from which the css parts will be extracted
      Returns:
      the list containing cssValue parts
      Since:
      1.0.0
    • throwExceptionForInvalidValue

      public static void throwExceptionForInvalidValue(String cssValue) throws NullValueException, InvalidValueException
      This method throws NullValueException if the given cssValue is null or InvalidValueException if the given cssValue is blank.
      Parameters:
      cssValue -
      Throws:
      NullValueException
      InvalidValueException
      Since:
      1.0.0