Class CssTypesValidationUtils
- java.lang.Object
-
- com.itextpdf.styledxmlparser.css.util.CssTypesValidationUtils
-
public final class CssTypesValidationUtils extends java.lang.ObjectUtilities class for CSS types validating operations.
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.String[]ANGLE_MEASUREMENTS_VALUESprivate static java.util.regex.PatternBASE64_PATTERNprivate static java.util.regex.PatternDATA_PATTERNprivate static java.lang.String[]RELATIVE_MEASUREMENTS_VALUES
-
Constructor Summary
Constructors Modifier Constructor Description privateCssTypesValidationUtils()Creates a newCssTypesValidationUtilsinstance.
-
Method Summary
All Methods Static Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static booleancontainsInitialOrInheritOrUnset(java.lang.String value)Checks if value contains initial, inherit or unset.static booleanisAngleValue(java.lang.String valueArgument)Checks whether a string contains an allowed metric unit in HTML/CSS; rad, deg and grad.static booleanisBase64Data(java.lang.String data)Deprecated.useisInlineData(String)instead.static booleanisColorProperty(java.lang.String value)Checks if a value is a color property.static booleanisEmValue(java.lang.String valueArgument)Checks whether a string contains an allowed value relative to parent value.static booleanisExValue(java.lang.String valueArgument)Checks whether a string contains an allowed value relative to element font height.static booleanisInitialOrInheritOrUnset(java.lang.String value)Checks if value is initial, inherit or unset.static booleanisInlineData(java.lang.String data)Checks if the string represent inline data in format `data:{FORMAT};{ENCODING},{DATA}`.static booleanisIntegerNumber(java.lang.String value)Checks whether a string matches an integer numeric value (e.g.static booleanisMetricValue(java.lang.String valueArgument)Checks whether a string contains an allowed metric unit in HTML/CSS; px, in, cm, mm, pc, Q or pt.(package private) static booleanisMetricZeroValue(java.lang.String valueArgument)static booleanisNegativeValue(java.lang.String value)Checks whether a string matches a negative value (e.g.static booleanisNumber(java.lang.String value)Checks whether a string matches a numeric value (e.g.(package private) static booleanisNumericZeroValue(java.lang.String value)static booleanisPercentageValue(java.lang.String valueArgument)Checks whether a string contains a percentage valuestatic booleanisRelativeValue(java.lang.String valueArgument)Checks whether a string contains an allowed value relative to previously set value.(package private) static booleanisRelativeZeroValue(java.lang.String valueArgument)static booleanisRemValue(java.lang.String valueArgument)Checks whether a string contains an allowed value relative to previously set root value.static booleanisValidNumericValue(java.lang.String value)Checks if a string is in a valid format.static booleanisZero(java.lang.String value)Checks whether a string contains a zero.
-
-
-
Field Detail
-
ANGLE_MEASUREMENTS_VALUES
private static final java.lang.String[] ANGLE_MEASUREMENTS_VALUES
-
RELATIVE_MEASUREMENTS_VALUES
private static final java.lang.String[] RELATIVE_MEASUREMENTS_VALUES
-
BASE64_PATTERN
private static final java.util.regex.Pattern BASE64_PATTERN
-
DATA_PATTERN
private static final java.util.regex.Pattern DATA_PATTERN
-
-
Constructor Detail
-
CssTypesValidationUtils
private CssTypesValidationUtils()
Creates a newCssTypesValidationUtilsinstance.
-
-
Method Detail
-
isAngleValue
public static boolean isAngleValue(java.lang.String valueArgument)
Checks whether a string contains an allowed metric unit in HTML/CSS; rad, deg and grad.- Parameters:
valueArgument- the string that needs to be checked- Returns:
- boolean true if value contains an allowed angle value
-
isBase64Data
@Deprecated public static boolean isBase64Data(java.lang.String data)
Deprecated.useisInlineData(String)instead.Checks if a data is base 64 encoded.- Parameters:
data- the data- Returns:
- true, if the data is base 64 encoded
-
isInlineData
public static boolean isInlineData(java.lang.String data)
Checks if the string represent inline data in format `data:{FORMAT};{ENCODING},{DATA}`.- Parameters:
data- the string to check- Returns:
- true, if the string is inline data
-
isColorProperty
public static boolean isColorProperty(java.lang.String value)
Checks if a value is a color property.- Parameters:
value- the value- Returns:
- true, if the value contains a color property
-
isEmValue
public static boolean isEmValue(java.lang.String valueArgument)
Checks whether a string contains an allowed value relative to parent value.- Parameters:
valueArgument- the string that needs to be checked- Returns:
- boolean true if value contains a em value
-
isExValue
public static boolean isExValue(java.lang.String valueArgument)
Checks whether a string contains an allowed value relative to element font height.- Parameters:
valueArgument- the string that needs to be checked- Returns:
- boolean true if value contains a ex value
-
isMetricValue
public static boolean isMetricValue(java.lang.String valueArgument)
Checks whether a string contains an allowed metric unit in HTML/CSS; px, in, cm, mm, pc, Q or pt.- Parameters:
valueArgument- the string that needs to be checked- Returns:
- boolean true if value contains an allowed metric value
-
isNegativeValue
public static boolean isNegativeValue(java.lang.String value)
Checks whether a string matches a negative value (e.g. -123, -2em, -0.123). All these metric values are allowed in HTML/CSS.- Parameters:
value- the string that needs to be checked- Returns:
- true if value is negative
-
isNumber
public static boolean isNumber(java.lang.String value)
Checks whether a string matches a numeric value (e.g. 123, 1.23, .123). All these metric values are allowed in HTML/CSS.- Parameters:
value- the string that needs to be checked- Returns:
- boolean true if value contains an allowed metric value
-
isIntegerNumber
public static boolean isIntegerNumber(java.lang.String value)
Checks whether a string matches an integer numeric value (e.g. 123, 23). All these metric values are allowed in HTML/CSS.- Parameters:
value- the string that needs to be checked- Returns:
- boolean true if value contains an allowed metric value
-
isPercentageValue
public static boolean isPercentageValue(java.lang.String valueArgument)
Checks whether a string contains a percentage value- Parameters:
valueArgument- the string that needs to be checked- Returns:
- boolean true if value contains an allowed percentage value
-
isRelativeValue
public static boolean isRelativeValue(java.lang.String valueArgument)
Checks whether a string contains an allowed value relative to previously set value.- Parameters:
valueArgument- the string that needs to be checked- Returns:
- boolean true if value contains an allowed metric value
-
isRemValue
public static boolean isRemValue(java.lang.String valueArgument)
Checks whether a string contains an allowed value relative to previously set root value.- Parameters:
valueArgument- the string that needs to be checked- Returns:
- boolean true if value contains a rem value
-
isValidNumericValue
public static boolean isValidNumericValue(java.lang.String value)
Checks if a string is in a valid format.- Parameters:
value- the string that needs to be checked- Returns:
- boolean true if value is in a valid format
-
isInitialOrInheritOrUnset
public static boolean isInitialOrInheritOrUnset(java.lang.String value)
Checks if value is initial, inherit or unset.- Parameters:
value- value to check- Returns:
- true if value is initial, inherit or unset. false otherwise
-
containsInitialOrInheritOrUnset
public static boolean containsInitialOrInheritOrUnset(java.lang.String value)
Checks if value contains initial, inherit or unset.- Parameters:
value- value to check- Returns:
- true if value contains initial, inherit or unset. False otherwise
-
isZero
public static boolean isZero(java.lang.String value)
Checks whether a string contains a zero.- Parameters:
value- the string that needs to be checked- Returns:
- boolean true if value contains a zero
-
isMetricZeroValue
static boolean isMetricZeroValue(java.lang.String valueArgument)
-
isNumericZeroValue
static boolean isNumericZeroValue(java.lang.String value)
-
isRelativeZeroValue
static boolean isRelativeZeroValue(java.lang.String valueArgument)
-
-