Package com.google.api.server.spi
Class MethodHierarchyReader
- java.lang.Object
-
- com.google.api.server.spi.MethodHierarchyReader
-
public class MethodHierarchyReader extends Object
Utility to take a class and create maps of methods usable for endpoints and related data.On the first call, parses and stores the full hierarchy information. The cached full hierarchy is then used for all subsequent calls. Returned iterables, maps, and lists are copied out without reference to the original full hierarchy information to allow the caller to keep just the needed portion of information and release the full hierarchy along with this class.
- Author:
- Eric Orth
-
-
Constructor Summary
Constructors Constructor Description MethodHierarchyReader(Class<?> endpointClass)Constructs aMethodHierarchyReaderfor the given class type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Iterable<List<EndpointMethod>>getEndpointOverrides()Returns a collection of public service methods defined by the class and its super classes.Iterable<EndpointMethod>getLeafEndpointMethods()Returns a collection of public service methods defined by the class and its super classes.Iterable<Method>getLeafMethods()Returns a collection of public service methods defined by the class and its super classes.Iterable<List<Method>>getMethodOverrides()Returns a collection of public service methods defined by the class and its super classes.com.google.common.collect.ListMultimap<String,EndpointMethod>getNameToEndpointOverridesMap()Returns a mapping of public service methods defined by the class and its super classes, keyed by method name.Map<String,Method>getNameToLeafMethodMap()Returns a mapping of public service methods defined by the class and its super classes, keyed by method name.
-
-
-
Constructor Detail
-
MethodHierarchyReader
public MethodHierarchyReader(Class<?> endpointClass)
Constructs aMethodHierarchyReaderfor the given class type.- Parameters:
endpointClass- Must be a concrete type (not abstract or interface).
-
-
Method Detail
-
getLeafMethods
public Iterable<Method> getLeafMethods()
Returns a collection of public service methods defined by the class and its super classes. Bridge methods are ignored. Only the final leaf subclass version of each method is included.
-
getLeafEndpointMethods
public Iterable<EndpointMethod> getLeafEndpointMethods()
Returns a collection of public service methods defined by the class and its super classes. Bridge methods are ignored. Only the final leaf subclass version of each method is included. Methods are stored in the EndpointMethod container.
-
getMethodOverrides
public Iterable<List<Method>> getMethodOverrides()
Returns a collection of public service methods defined by the class and its super classes. Bridge methods are ignored. For each method, all valid method implementations are included, ordered subclass to superclass.
-
getEndpointOverrides
public Iterable<List<EndpointMethod>> getEndpointOverrides()
Returns a collection of public service methods defined by the class and its super classes. Bridge methods are ignored. For each method, all valid method implementations are included, ordered subclass to superclass. Methods are stored in the EndpointMethod container.
-
getNameToLeafMethodMap
public Map<String,Method> getNameToLeafMethodMap()
Returns a mapping of public service methods defined by the class and its super classes, keyed by method name. Bridge methods are ignored. Only the final leaf subclass version of each method is included.
-
getNameToEndpointOverridesMap
public com.google.common.collect.ListMultimap<String,EndpointMethod> getNameToEndpointOverridesMap()
Returns a mapping of public service methods defined by the class and its super classes, keyed by method name. Bridge methods are ignored. All valid method implementations are included, ordered subclass to superclass.
-
-