-
- All Known Implementing Classes:
BinaryContext,BooleanContext,DateContext,FormatContext,GenericContext,NumberContext,StringContext,TemporalContext
public interface TypeContext<T>A type context provides two basic services:- It enforces some sort of rule/limit regarding size, accuracy or similar. This feature is for instance useful when writing data to a database where attributes are often very specifically typed. "enforcing" is typically a one-way operation that cannot be undone.
- It translates back and forth between some specific type and String - essentially a formatter.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default Tenforce(T object)Will force the object to conform to the context's specification.java.lang.Stringformat(java.lang.Object object)Tparse(java.lang.CharSequence text)
-
-
-
Method Detail
-
enforce
default T enforce(T object)
Will force the object to conform to the context's specification. The default implementation formats aStringand then parses that back to an object (of the original type).
-
format
java.lang.String format(java.lang.Object object)
-
parse
T parse(java.lang.CharSequence text)
-
-