Package com.webfirmframework.wffweb.util
Class CssValueUtil
java.lang.Object
com.webfirmframework.wffweb.util.CssValueUtil
- Since:
- 1.0.0
-
Method Summary
Modifier and TypeMethodDescriptionvoid
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.splits each cssValue part based on the css rule.static void
throwExceptionForInvalidValue
(String cssValue) This method throwsNullValueException
if the givencssValue
is null orInvalidValueException
if the givencssValue
is blank.
-
Method Details
-
addCssValuePartStartEndValue
The given value is used by Web Firm Framework Index Based Extraction algorithm to extract css value parts, i.e. theCssValueUtil#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
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 returnedList<String>
) may contain invalid cssValue part.
Sample code to testfinal 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 throwsNullValueException
if the givencssValue
is null orInvalidValueException
if the givencssValue
is blank.- Parameters:
cssValue
-- Throws:
NullValueException
InvalidValueException
- Since:
- 1.0.0
-