IntrospectionModeller { public static AbstractResource createResource(Class<?> resourceClass) { final Class<?> annotatedResourceClass = getAnnotatedResourceClass(resourceClass); final Path rPathAnnotation = annotatedResourceClass.getAnnotation(Path.class); final boolean isRootResourceClass = (null != rPathAnnotation); final boolean isEncodedAnotOnClass = (null != annotatedResourceClass.getAnnotation(Encoded.class)); AbstractResource resource; if (isRootResourceClass) { resource = new AbstractResource(resourceClass, new PathValue(rPathAnnotation.value())); } else { resource = new AbstractResource(resourceClass); } workOutConstructorsList(resource, resourceClass.getConstructors(), isEncodedAnotOnClass); workOutFieldsList(resource, isEncodedAnotOnClass); final MethodList methodList = new MethodList(resourceClass); workOutSetterMethodsList(resource, methodList, isEncodedAnotOnClass); final Consumes classScopeConsumesAnnotation = annotatedResourceClass.getAnnotation(Consumes.class); final Produces classScopeProducesAnnotation = annotatedResourceClass.getAnnotation(Produces.class); workOutResourceMethodsList(resource, methodList, isEncodedAnotOnClass, classScopeConsumesAnnotation, classScopeProducesAnnotation); workOutSubResourceMethodsList(resource, methodList, isEncodedAnotOnClass, classScopeConsumesAnnotation, classScopeProducesAnnotation); workOutSubResourceLocatorsList(resource, methodList, isEncodedAnotOnClass); workOutPostConstructPreDestroy(resource); if (LOGGER.isLoggable(Level.FINEST)) { LOGGER.finest(ImplMessages.NEW_AR_CREATED_BY_INTROSPECTION_MODELER( resource.toString())); } return resource; }  static AbstractResource createResource(Class<?> resourceClass);  }
@Test public void testSubResource() { AbstractResource subResource = IntrospectionModeller.createResource(TestSubResourceOne.class); assertEquals(null, subResource.getPath()); assertEquals(2, subResource.getResourceMethods().size()); assertEquals(0, subResource.getSubResourceLocators().size()); assertEquals(0, subResource.getSubResourceMethods().size()); }