Class Resolver


  • class Resolver
    extends java.lang.Object
    Responsible for converting between domain and client entities. This class has a small amount of temporary state used to handle graph cycles and assignment of synthetic ids.
    See Also:
    RequestState.getResolver()
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      (package private) static int index​(java.lang.String path)
      Returns the trailing [n] index value from a path.
      (package private) static boolean matchesPropertyRef​(java.util.Set<java.lang.String> propertyRefs, java.lang.String newPrefix)
      Returns true if the given prefix is one of the requested property references.
      java.lang.Object resolveClientValue​(java.lang.Object domainValue, java.lang.reflect.Type assignableTo, java.util.Set<java.lang.String> propertyRefs)
      Given a domain object, return a value that can be encoded by the client.
      java.lang.Object resolveDomainValue​(java.lang.Object maybeEntityProxy, boolean detectDeadEntities)
      Convert a client-side value into a domain value.
      (package private) static java.lang.String snipIndex​(java.lang.String path)
      Removes the trailing [n] from a path.
      • Methods inherited from class java.lang.Object

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

      • index

        static int index​(java.lang.String path)
        Returns the trailing [n] index value from a path.
      • matchesPropertyRef

        static boolean matchesPropertyRef​(java.util.Set<java.lang.String> propertyRefs,
                                          java.lang.String newPrefix)
        Returns true if the given prefix is one of the requested property references.
      • snipIndex

        static java.lang.String snipIndex​(java.lang.String path)
        Removes the trailing [n] from a path.
      • resolveClientValue

        public java.lang.Object resolveClientValue​(java.lang.Object domainValue,
                                                   java.lang.reflect.Type assignableTo,
                                                   java.util.Set<java.lang.String> propertyRefs)
        Given a domain object, return a value that can be encoded by the client.
        Parameters:
        domainValue - the domain object to be converted into a client-side value
        assignableTo - the type in the client to which the resolved value should be assignable. A value of null indicates that any resolution will suffice.
        propertyRefs - the property references requested by the client
      • resolveDomainValue

        public java.lang.Object resolveDomainValue​(java.lang.Object maybeEntityProxy,
                                                   boolean detectDeadEntities)
        Convert a client-side value into a domain value.
        Parameters:
        maybeEntityProxy - the client object to resolve
        detectDeadEntities - if true this method will throw a ReportableException containing a DeadEntityException if an EntityProxy cannot be resolved