final ResolvedType responseType = TYPE_RESOLVER .resolve(method.getInvocable().getResponseType()); final Class<?> erasedType = !responseType.getTypeBindings().isEmpty() ? responseType.getTypeBindings().getBoundType(0).getErasedType() : responseType.getErasedType();
@Override public boolean appliesTo(ResolvedType type) { return type.getErasedType() == genericType && !type.getTypeBindings().isEmpty() && boundTypeIndex <= type.getTypeBindings().size() - 1; }
private ResolvedType _constructType(ClassStack context, Class<?> rawType, TypeBindings typeBindings) { // Ok: no easy shortcut, let's figure out type of type... if (rawType.isArray()) { ResolvedType elementType = _fromAny(context, rawType.getComponentType(), typeBindings); return new ResolvedArrayType(rawType, typeBindings, elementType); } // Work-around/fix for [#33]: if the type has no type parameters, don't include // typeBindings in the ResolvedType if (!typeBindings.isEmpty() && rawType.getTypeParameters().length == 0) { typeBindings = TypeBindings.emptyBindings(); } // For other types super interfaces are needed... if (rawType.isInterface()) { return new ResolvedInterfaceType(rawType, typeBindings, _resolveSuperInterfaces(context, rawType, typeBindings)); } return new ResolvedObjectType(rawType, typeBindings, _resolveSuperClass(context, rawType, typeBindings), _resolveSuperInterfaces(context, rawType, typeBindings)); }
private ResolvedType _constructType(ClassStack context, Class<?> rawType, TypeBindings typeBindings) { // Ok: no easy shortcut, let's figure out type of type... if (rawType.isArray()) { ResolvedType elementType = _fromAny(context, rawType.getComponentType(), typeBindings); return new ResolvedArrayType(rawType, typeBindings, elementType); } // Work-around/fix for [#33]: if the type has no type parameters, don't include // typeBindings in the ResolvedType if (!typeBindings.isEmpty() && rawType.getTypeParameters().length == 0) { typeBindings = TypeBindings.emptyBindings(); } // For other types super interfaces are needed... if (rawType.isInterface()) { return new ResolvedInterfaceType(rawType, typeBindings, _resolveSuperInterfaces(context, rawType, typeBindings)); } return new ResolvedObjectType(rawType, typeBindings, _resolveSuperClass(context, rawType, typeBindings), _resolveSuperInterfaces(context, rawType, typeBindings)); }
private void populate(String basePath, Class<?> klass, boolean isLocator, Resource resource, Set<EndpointLogLine> endpointLogLines) { if (!isLocator) { basePath = normalizePath(basePath, resource.getPath()); } for (ResourceMethod method : resource.getResourceMethods()) { endpointLogLines.add(new EndpointLogLine(method.getHttpMethod(), basePath, klass)); } for (Resource childResource : resource.getChildResources()) { for (ResourceMethod method : childResource.getAllMethods()) { if (method.getType() == ResourceMethod.JaxrsType.RESOURCE_METHOD) { final String path = normalizePath(basePath, childResource.getPath()); endpointLogLines.add(new EndpointLogLine(method.getHttpMethod(), path, klass)); } else if (method.getType() == ResourceMethod.JaxrsType.SUB_RESOURCE_LOCATOR) { final String path = normalizePath(basePath, childResource.getPath()); final ResolvedType responseType = TYPE_RESOLVER .resolve(method.getInvocable().getResponseType()); final Class<?> erasedType = !responseType.getTypeBindings().isEmpty() ? responseType.getTypeBindings().getBoundType(0).getErasedType() : responseType.getErasedType(); if (Resource.from(erasedType) == null) { endpointLogLines.add(new EndpointLogLine(method.getHttpMethod(), path, erasedType)); } else { populate(path, erasedType, true, endpointLogLines); } } } } }