org.omnaest.utils.beans.adapter.source
Annotation Type DefaultValue
@Documented
@Retention(value=RUNTIME)
@Target(value=METHOD)
public @interface DefaultValue
The DefaultValue Annotation allows to declare a value which is used as default value, if a given or returned
value of a method is null.
The values are specified as String and will be converted to any type which has a single String parameter
constructor or a valueOf method like Double.valueOf(String) .
Example:
protected interface ExampleInterface
{
@DefaultValue(value = "defaultValueSet")
public void setFieldString( String value );
@DefaultValue(value = "defaultValueGet")
public String getFieldString();
@DefaultValue(value = "1.23")
public void setFieldDouble( Double value );
@DefaultValue(value = "3.45")
public Double getFieldDouble();
}
- Author:
- Omnaest
- See Also:
defaultValueConverterTypes()
value
public abstract String value
defaultValueConverterTypes
public abstract Class<? extends ElementConverter<String,?>>[] defaultValueConverterTypes
ElementConverter types specified here can be used to transform a default value String into any other result
object. This can be used to create more complex default value Objects. If multiple ElementConverter types are
specified, they are used in ascending index position order (from left to right).
- Returns:
- Default:
- {}
Copyright © 2013. All Rights Reserved.