Interface TypeContext<T>

All Known Implementing Classes:
BinaryContext, BooleanContext, DateContext, FormatContext, GenericContext, NumberContext, StringContext, TemporalContext

public interface TypeContext<T>
A type context provides two basic services:
  1. 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.
  2. It translates back and forth between some specific type and String - essentially a formatter.
  • Method Summary

    Modifier and Type
    Method
    Description
    default T
    enforce(T object)
    Will force the object to conform to the context's specification.
    format(Object object)
     
     
  • Method Details

    • enforce

      default T enforce(T object)
      Will force the object to conform to the context's specification. The default implementation formats a String and then parses that back to an object (of the original type).
    • format

      String format(Object object)
    • parse

      T parse(CharSequence text)