Class ColorConverter
java.lang.Object
org.apache.commons.beanutils2.converters.AbstractConverter<Color>
org.apache.commons.beanutils2.converters.ColorConverter
Converter implementation that handles conversion to and from Color.
 
 Will interpret hexadecimal colors similar to CSS engines, for example #RGB is interpreted as #RRGGBB. If using the literal hexadecimal value is desired, the
 value should be prefixed with 0x instead of #.
 
- Since:
- 2.0.0
- 
Constructor SummaryConstructorsConstructorDescriptionConstruct aColorConverter that throws aConversionExceptionif an error occurs.ColorConverter(Color defaultValue) Constructs aConverterthat will return the specified default value if a conversion error occurs.
- 
Method SummaryModifier and TypeMethodDescriptionprotected <T> TconvertToType(Class<T> type, Object value) Gets the default type thisConverterhandles.Methods inherited from class org.apache.commons.beanutils2.converters.AbstractConverterconversionException, convert, convertArray, convertToString, getDefault, handleError, handleMissing, isUseDefault, setDefaultValue, toLowerCase, toString, toString, toTrim
- 
Constructor Details- 
ColorConverterpublic ColorConverter()Construct aColorConverter that throws aConversionExceptionif an error occurs.
- 
ColorConverterConstructs aConverterthat will return the specified default value if a conversion error occurs.- Parameters:
- defaultValue- The default value to be returned if the value to be converted is missing or an error occurs converting the value.
 
 
- 
- 
Method Details- 
convertToTypeConverts aColorinto aString.Supports hexadecimal colors like #RGB, #RRGGBB, #RGBA, and #RRGGBBAA, and interprets raw color names based on the colors defined in Java, such as: - Specified by:
- convertToTypein class- AbstractConverter<Color>
- Type Parameters:
- T- Target type of the conversion.
- Parameters:
- type- Data type to which this value should be converted.
- value- The String property value to convert.
- Returns:
- A Colorwhich represents the compiled configuration property.
- Throws:
- NullPointerException- If the value is null.
- NumberFormatException- If an invalid number is provided.
- Throwable- if an error occurs converting to the specified type
 
- 
getDefaultTypeGets the default type thisConverterhandles.- Specified by:
- getDefaultTypein class- AbstractConverter<Color>
- Returns:
- The default type this Converterhandles.
- Since:
- 2.0.0
 
 
-