Class LambdaFetchingSupport


  • public class LambdaFetchingSupport
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.util.Optional<java.util.function.Function<java.lang.Object,​java.lang.Object>> createGetter​(java.lang.Class<?> sourceClass, java.lang.String propertyName)
      This support class will use LambdaMetafactory and MethodHandles to create a dynamic function that allows access to a public getter method on the nominated class.
      • Methods inherited from class java.lang.Object

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

      • LambdaFetchingSupport

        public LambdaFetchingSupport()
    • Method Detail

      • createGetter

        public static java.util.Optional<java.util.function.Function<java.lang.Object,​java.lang.Object>> createGetter​(java.lang.Class<?> sourceClass,
                                                                                                                            java.lang.String propertyName)
        This support class will use LambdaMetafactory and MethodHandles to create a dynamic function that allows access to a public getter method on the nominated class. MethodHandles is a caller senstive lookup mechanism. If the graphql-java cant lookup a class, then it won't be able to make dynamic lambda function to it.

        If one cant be made, because it doesn't exist or the calling class does not have access to the method, then it will return an empty result indicating that this strategy cant be used.

        Parameters:
        sourceClass - the class that has the property getter method
        propertyName - the name of the property to get
        Returns:
        a function that can be used to pass in an instance of source class and returns its getter method value