Package graphql.schema
Class PropertyFetchingImpl
java.lang.Object
graphql.schema.PropertyFetchingImpl
A re-usable class that can fetch from POJOs
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classprivate final classprivate static final classprivate static classprivate static interface -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final ConcurrentMap<PropertyFetchingImpl.CacheKey, Field> private final ConcurrentMap<PropertyFetchingImpl.CacheKey, PropertyFetchingImpl.CachedLambdaFunction> private static final org.slf4j.Loggerprivate final Class<?> private final AtomicBooleanprivate final AtomicBooleanprivate final AtomicBoolean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprivate MethodfindPubliclyAccessibleMethod(PropertyFetchingImpl.CacheKey cacheKey, Class<?> rootClass, String methodName, boolean dfeInUse, boolean allowStaticMethods) Invoking public methods on package-protected classes via reflection causes exceptions.private MethodfindRecordMethod(PropertyFetchingImpl.CacheKey cacheKey, Class<?> rootClass, String methodName) private MethodfindViaSetAccessible(PropertyFetchingImpl.CacheKey cacheKey, Class<?> aClass, String methodName, boolean dfeInUse) getPropertyValue(String propertyName, Object object, GraphQLType graphQLType, boolean dfeInUse, Supplier<Object> singleArgumentValue) private ObjectgetPropertyViaFieldAccess(PropertyFetchingImpl.CacheKey cacheKey, Object object, String propertyName) private ObjectgetPropertyViaGetterMethod(Object object, String propertyName, GraphQLType graphQLType, PropertyFetchingImpl.MethodFinder methodFinder, Supplier<Object> singleArgumentValue) private ObjectgetPropertyViaGetterUsingPrefix(Object object, String propertyName, String prefix, PropertyFetchingImpl.MethodFinder methodFinder, Supplier<Object> singleArgumentValue) private ObjectgetPropertyViaRecordMethod(Object object, String propertyName, PropertyFetchingImpl.MethodFinder methodFinder, Supplier<Object> singleArgumentValue) private booleanhasZeroArgs(Method mth) private ObjectinvokeField(Object object, Field field) private ObjectinvokeMethod(Object object, Supplier<Object> singleArgumentValue, Method method, boolean takesSingleArgument) private booleanisBooleanProperty(GraphQLType graphQLType) private booleanprivate booleanisSuitablePublicMethod(Method method, boolean allowStaticMethods) lambdaGetter(String propertyName, Object object) private PropertyFetchingImpl.CacheKeymkCacheKey(Object object, String propertyName) private static Comparator<? super Method> private voidbooleansetUseLambdaFactory(boolean flag) booleansetUseNegativeCache(boolean flag) booleansetUseSetAccessible(boolean flag) private boolean
-
Field Details
-
log
private static final org.slf4j.Logger log -
USE_SET_ACCESSIBLE
-
USE_LAMBDA_FACTORY
-
USE_NEGATIVE_CACHE
-
LAMBDA_CACHE
private final ConcurrentMap<PropertyFetchingImpl.CacheKey,PropertyFetchingImpl.CachedLambdaFunction> LAMBDA_CACHE -
METHOD_CACHE
private final ConcurrentMap<PropertyFetchingImpl.CacheKey,PropertyFetchingImpl.CachedMethod> METHOD_CACHE -
FIELD_CACHE
-
NEGATIVE_CACHE
private final ConcurrentMap<PropertyFetchingImpl.CacheKey,PropertyFetchingImpl.CacheKey> NEGATIVE_CACHE -
singleArgumentType
-
-
Constructor Details
-
PropertyFetchingImpl
-
-
Method Details
-
getPropertyValue
-
lambdaGetter
-
isNegativelyCached
-
putInNegativeCache
-
getPropertyViaRecordMethod
private Object getPropertyViaRecordMethod(Object object, String propertyName, PropertyFetchingImpl.MethodFinder methodFinder, Supplier<Object> singleArgumentValue) throws NoSuchMethodException - Throws:
NoSuchMethodException
-
getPropertyViaGetterMethod
private Object getPropertyViaGetterMethod(Object object, String propertyName, GraphQLType graphQLType, PropertyFetchingImpl.MethodFinder methodFinder, Supplier<Object> singleArgumentValue) throws NoSuchMethodException - Throws:
NoSuchMethodException
-
getPropertyViaGetterUsingPrefix
private Object getPropertyViaGetterUsingPrefix(Object object, String propertyName, String prefix, PropertyFetchingImpl.MethodFinder methodFinder, Supplier<Object> singleArgumentValue) throws NoSuchMethodException - Throws:
NoSuchMethodException
-
findPubliclyAccessibleMethod
private Method findPubliclyAccessibleMethod(PropertyFetchingImpl.CacheKey cacheKey, Class<?> rootClass, String methodName, boolean dfeInUse, boolean allowStaticMethods) throws NoSuchMethodException Invoking public methods on package-protected classes via reflection causes exceptions. This method searches a class's hierarchy for public visibility parent classes with the desired getter. This particular case is required to support AutoValue style data classes, which have abstract public interfaces implemented by package-protected (generated) subclasses.- Throws:
NoSuchMethodException
-
isSuitablePublicMethod
-
findRecordMethod
private Method findRecordMethod(PropertyFetchingImpl.CacheKey cacheKey, Class<?> rootClass, String methodName) throws NoSuchMethodException - Throws:
NoSuchMethodException
-
findViaSetAccessible
private Method findViaSetAccessible(PropertyFetchingImpl.CacheKey cacheKey, Class<?> aClass, String methodName, boolean dfeInUse) throws NoSuchMethodException - Throws:
NoSuchMethodException
-
getPropertyViaFieldAccess
private Object getPropertyViaFieldAccess(PropertyFetchingImpl.CacheKey cacheKey, Object object, String propertyName) throws PropertyFetchingImpl.FastNoSuchMethodException -
invokeMethod
-
invokeField
-
isBooleanProperty
-
clearReflectionCache
public void clearReflectionCache() -
setUseSetAccessible
public boolean setUseSetAccessible(boolean flag) -
setUseLambdaFactory
public boolean setUseLambdaFactory(boolean flag) -
setUseNegativeCache
public boolean setUseNegativeCache(boolean flag) -
mkCacheKey
-
hasZeroArgs
-
takesSingleArgumentTypeAsOnlyArgument
-
mostMethodArgsFirst
-