Class EnumConverter
java.lang.Object
name.matthewgreet.strutscommons.policy.AbstractPolicySupport<EnumConversion>
name.matthewgreet.strutscommons.policy.AbstractValidatorSupport<EnumConversion>
name.matthewgreet.strutscommons.policy.AbstractConverterSupport<EnumConversion,Enum>
name.matthewgreet.strutscommons.policy.EnumConverter
- All Implemented Interfaces:
Converter<EnumConversion,
,Enum> Policy<EnumConversion>
,Validator<EnumConversion>
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns result of conversion of form field.Returns single field value formatted for display in a form field.Returns message set by annotation.Returns message key set by annotation, which is used to retrieve message from Action's TextProvider if it's not empty string.Returns whether to write any error message to action errors, field errors, or action messages.boolean
Returns whetherConverter.convert(java.lang.String, java.lang.Class<? extends T>)
converts empty string value, andConverter.format(T)
formats null value.Returns types of recipient fields that can receive converted form value or, if recipient should be a list, types of entries.Returns name of field to receive converted form value, which can be empty string to use default.Methods inherited from class name.matthewgreet.strutscommons.policy.AbstractPolicySupport
getAnnotation, setAnnotation
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface name.matthewgreet.strutscommons.policy.Policy
getAnnotation, setAnnotation
-
Constructor Details
-
EnumConverter
public EnumConverter()
-
-
Method Details
-
format
Description copied from interface:Converter
Returns single field value formatted for display in a form field. Only applies single value recipients. Not called if the unformatted value is null, unlessConverter.getProcessNoValue()
returns true..- Throws:
Exception
-
getRecipientClass
Description copied from interface:Converter
Returns types of recipient fields that can receive converted form value or, if recipient should be a list, types of entries. -
getMessageType
Description copied from interface:Validator
Returns whether to write any error message to action errors, field errors, or action messages. -
getMessage
Description copied from interface:Validator
Returns message set by annotation. Used ifValidator.getMessageKey()
is empty string or it fails to find a message. -
getMessageKey
Description copied from interface:Validator
Returns message key set by annotation, which is used to retrieve message from Action's TextProvider if it's not empty string. -
getRecipientFieldName
Description copied from interface:Converter
Returns name of field to receive converted form value, which can be empty string to use default. -
convert
public ConversionResult<Enum> convert(String formValue, Class<? extends Enum> recipientClass) throws Exception Description copied from interface:Converter
Returns result of conversion of form field. This is not called if the form value is empty string or null, unlessConverter.getProcessNoValue()
returns true.- Throws:
Exception
-
getProcessNoValue
public boolean getProcessNoValue()Description copied from interface:Converter
Returns whetherConverter.convert(java.lang.String, java.lang.Class<? extends T>)
converts empty string value, andConverter.format(T)
formats null value.
-