Package com.google.api.server.spi
Class EndpointMethod
- java.lang.Object
-
- com.google.api.server.spi.EndpointMethod
-
public class EndpointMethod extends Object
A class which takes care to resolved any parameterized types for endpoints. That way we can support inheritance from generic base classes without needing to override and specialize the method when it has a sensible default.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description classEndpointMethod.ResolvedSignatureAdapter class to compareEndpointMethodinstances based on their Java method signature rather than the actual method implementation.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static EndpointMethodcreate(Class<?> endpointClass, Method method)Creates anEndpointMethodusing type information directly available from the method's declaring class.static EndpointMethodcreate(Class<?> endpointClass, Method method, com.google.common.reflect.TypeToken<?> declaringClass)Creates anEndpointMethodusing type information from the givenTypeToken.booleanequals(Object o)static Class<?>getClassFromType(Type type)Returns the class associated withtype.Class<?>getEndpointClass()Returns the endpoint class.MethodgetMethod()Returns the underlying method object.Class<?>[]getParameterClasses()Returns the parameter classes of the method.List<String>getParameterNames()com.google.common.reflect.TypeToken<?>[]getParameterTypes()Returns the parameter types of the method.EndpointMethod.ResolvedSignaturegetResolvedMethodSignature()com.google.common.reflect.TypeToken<?>getReturnType()Returns the return type of the method.inthashCode()voidsetParameterNames(List<String> parameterNames)StringtoString()
-
-
-
Method Detail
-
getClassFromType
public static Class<?> getClassFromType(Type type)
Returns the class associated withtype. If this is a parameterized type or generic array, then its raw or component type, respectively, will be returned. Null is returned iftypeis not implemented by aClass<?>,ParameterizedType, orGenericArrayTypeobject.
-
getEndpointClass
public Class<?> getEndpointClass()
Returns the endpoint class.
-
getMethod
public Method getMethod()
Returns the underlying method object.
-
getReturnType
public com.google.common.reflect.TypeToken<?> getReturnType()
Returns the return type of the method.
-
getParameterTypes
public com.google.common.reflect.TypeToken<?>[] getParameterTypes()
Returns the parameter types of the method.
-
getParameterClasses
public Class<?>[] getParameterClasses()
Returns the parameter classes of the method.
-
create
public static EndpointMethod create(Class<?> endpointClass, Method method, com.google.common.reflect.TypeToken<?> declaringClass)
Creates anEndpointMethodusing type information from the givenTypeToken.- Parameters:
method- Must not have wildcard types (all generic types must be resolvable to a concrete type using the givenTypeToken).declaringClass- A token for the method's declaring class.
-
create
public static EndpointMethod create(Class<?> endpointClass, Method method)
Creates anEndpointMethodusing type information directly available from the method's declaring class.- Parameters:
method- Must not have wildcard types (all generic types must be resolvable to a concrete type using type information from the method's declaring class).
-
getResolvedMethodSignature
public EndpointMethod.ResolvedSignature getResolvedMethodSignature()
-
-