Package net.sourceforge.pmd.properties
Class PropertySerializer<T>
- java.lang.Object
-
- net.sourceforge.pmd.properties.PropertySerializer<T>
-
public abstract class PropertySerializer<T> extends Object
Strategy to serialize a value to and from strings.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract T
fromString(@NonNull String attributeData)
Read the value from a string, if it is supported.abstract List<PropertyConstraint<? super T>>
getConstraints()
Returns the constraints that this mapper applies to values after parsing them.abstract @NonNull String
toString(T value)
Format the value to a string.PropertySerializer<T>
withConstraint(PropertyConstraint<? super T> t)
Returns a new XML mapper that will check parsed values with the given constraint.
-
-
-
Method Detail
-
getConstraints
public abstract List<PropertyConstraint<? super T>> getConstraints()
Returns the constraints that this mapper applies to values after parsing them. This may be used for documentation, or to check a constraint on a value that was not parsed from XML.
-
withConstraint
public PropertySerializer<T> withConstraint(PropertyConstraint<? super T> t)
Returns a new XML mapper that will check parsed values with the given constraint.
-
fromString
public abstract T fromString(@NonNull String attributeData)
Read the value from a string, if it is supported.- Throws:
IllegalArgumentException
- if something goes wrong (but should be reported on the error reporter)
-
toString
public abstract @NonNull String toString(T value)
Format the value to a string.- Throws:
IllegalArgumentException
- if something goes wrong (but should be reported on the error reporter)
-
-