Class ProtocolToModelAdapter

  • All Implemented Interfaces:
    ObjectGraphAdapter

    public class ProtocolToModelAdapter
    extends java.lang.Object
    implements ObjectGraphAdapter
    Adapts some source object to some target view type.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      <T> T adapt​(java.lang.Class<T> targetType, java.lang.Object sourceObject)
      Adapts the source object to a view object.
      <T> ViewBuilder<T> builder​(java.lang.Class<T> viewType)
      Creates a builder for views of the given type.
      ObjectGraphAdapter newGraph()
      Creates an adapter for a single object graph.
      static <T extends java.lang.Enum<T>>
      T
      toEnum​(java.lang.Class<? extends T> enumType, java.lang.String literal)  
      static java.lang.String toWords​(java.lang.CharSequence string, char separator)  
      java.lang.Object unpack​(java.lang.Object viewObject)
      Unpacks the source object from a given view object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • ProtocolToModelAdapter

        public ProtocolToModelAdapter()
      • ProtocolToModelAdapter

        public ProtocolToModelAdapter​(TargetTypeProvider targetTypeProvider)
    • Method Detail

      • newGraph

        public ObjectGraphAdapter newGraph()
        Creates an adapter for a single object graph. Each object adapted by the returned adapter is treated as part of the same object graph, for the purposes of caching etc.
        Returns:
        the adapter
      • adapt

        public <T> T adapt​(java.lang.Class<T> targetType,
                           java.lang.Object sourceObject)
        Adapts the source object to a view object.
        Specified by:
        adapt in interface ObjectGraphAdapter
      • builder

        public <T> ViewBuilder<T> builder​(java.lang.Class<T> viewType)
        Creates a builder for views of the given type.
        Specified by:
        builder in interface ObjectGraphAdapter
      • toEnum

        public static <T extends java.lang.Enum<T>> T toEnum​(java.lang.Class<? extends T> enumType,
                                                             java.lang.String literal)
      • toWords

        public static java.lang.String toWords​(java.lang.CharSequence string,
                                               char separator)
      • unpack

        public java.lang.Object unpack​(java.lang.Object viewObject)
        Unpacks the source object from a given view object.
        Parameters:
        viewObject - the object to unpack
        Returns:
        the unpacked object