@Override public Class<? extends ServiceLocator> resolveServiceLocator( Class<? extends RequestContext> requestContext) { Class<? extends ServiceLocator> locatorType; Service l = requestContext.getAnnotation(Service.class); ServiceName ln = requestContext.getAnnotation(ServiceName.class); if (l != null && !ServiceLocator.class.equals(l.locator())) { locatorType = l.locator(); } else if (ln != null && ln.locator().length() > 0) { try { locatorType = Class.forName(ln.locator(), false, getTop().getDomainClassLoader()).asSubclass( ServiceLocator.class); } catch (ClassNotFoundException e) { return die(e, "Could not find the locator type specified in the @%s annotation %s", ServiceName.class.getCanonicalName(), ln.value()); } } else { locatorType = null; } return locatorType; }
@Override public Class<?> resolveServiceClass(Class<? extends RequestContext> requestContextClass) { Class<?> searchIn = null; Service s = requestContextClass.getAnnotation(Service.class); if (s != null) { searchIn = s.value(); } ServiceName sn = requestContextClass.getAnnotation(ServiceName.class); if (sn != null) { searchIn = forName(sn.value()); } if (searchIn == null) { die(null, "The %s type %s did not specify a service type", RequestContext.class .getSimpleName(), requestContextClass.getCanonicalName()); } return searchIn; }
private boolean hasServiceLocator(TypeElement x, State state) { Service service = x.getAnnotation(Service.class); if (service != null) { // See javadoc on getAnnotation try { service.locator(); throw new RuntimeException("Should not reach here"); } catch (MirroredTypeException expected) { TypeMirror locatorType = expected.getTypeMirror(); return !state.types.asElement(locatorType).equals(state.serviceLocatorType.asElement()); } } ServiceName serviceName = x.getAnnotation(ServiceName.class); return serviceName != null && !serviceName.locator().isEmpty(); }
@Override public Void visitType(TypeElement x, State state) { checkedElement = x; Service service = x.getAnnotation(Service.class); ServiceName serviceName = x.getAnnotation(ServiceName.class); JsonRpcService jsonRpcService = x.getAnnotation(JsonRpcService.class); if (service != null) { poisonIfAnnotationPresent(state, x, serviceName, jsonRpcService); // See javadoc on Element.getAnnotation() for why it works this way try { service.value(); throw new RuntimeException("Should not reach here"); } catch (MirroredTypeException expected) { TypeMirror type = expected.getTypeMirror(); state.addMapping(x, (TypeElement) state.types.asElement(type)); } } if (serviceName != null) { poisonIfAnnotationPresent(state, x, jsonRpcService); TypeElement domain = state.elements.getTypeElement(BinaryName.toSourceName(serviceName.value())); if (domain == null) { state.warn(x, Messages.contextMissingDomainType(serviceName.value())); } state.addMapping(x, domain); } scanAllInheritedMethods(x, state); state.checkExtraTypes(x); return null; }
private boolean hasServiceLocator(TypeElement x, State state) { Service service = x.getAnnotation(Service.class); if (service != null) { // See javadoc on getAnnotation try { service.locator(); throw new RuntimeException("Should not reach here"); } catch (MirroredTypeException expected) { TypeMirror locatorType = expected.getTypeMirror(); return !state.types.asElement(locatorType).equals(state.serviceLocatorType.asElement()); } } ServiceName serviceName = x.getAnnotation(ServiceName.class); return serviceName != null && !serviceName.locator().isEmpty(); }
@Override public Class<? extends ServiceLocator> resolveServiceLocator( Class<? extends RequestContext> requestContext) { Class<? extends ServiceLocator> locatorType; Service l = requestContext.getAnnotation(Service.class); ServiceName ln = requestContext.getAnnotation(ServiceName.class); if (l != null && !ServiceLocator.class.equals(l.locator())) { locatorType = l.locator(); } else if (ln != null && ln.locator().length() > 0) { try { locatorType = Class.forName(ln.locator(), false, getTop().getDomainClassLoader()).asSubclass( ServiceLocator.class); } catch (ClassNotFoundException e) { return die(e, "Could not find the locator type specified in the @%s annotation %s", ServiceName.class.getCanonicalName(), ln.value()); } } else { locatorType = null; } return locatorType; }
@Override public Class<?> resolveServiceClass(Class<? extends RequestContext> requestContextClass) { Class<?> searchIn = null; Service s = requestContextClass.getAnnotation(Service.class); if (s != null) { searchIn = s.value(); } ServiceName sn = requestContextClass.getAnnotation(ServiceName.class); if (sn != null) { searchIn = forName(sn.value()); } if (searchIn == null) { die(null, "The %s type %s did not specify a service type", RequestContext.class .getSimpleName(), requestContextClass.getCanonicalName()); } return searchIn; }
private boolean hasServiceLocator(TypeElement x, State state) { Service service = x.getAnnotation(Service.class); if (service != null) { // See javadoc on getAnnotation try { service.locator(); throw new RuntimeException("Should not reach here"); } catch (MirroredTypeException expected) { TypeMirror locatorType = expected.getTypeMirror(); return !state.types.asElement(locatorType).equals(state.serviceLocatorType.asElement()); } } ServiceName serviceName = x.getAnnotation(ServiceName.class); return serviceName != null && !serviceName.locator().isEmpty(); }
@Override public Class<? extends ServiceLocator> resolveServiceLocator( Class<? extends RequestContext> requestContext) { Class<? extends ServiceLocator> locatorType; Service l = requestContext.getAnnotation(Service.class); ServiceName ln = requestContext.getAnnotation(ServiceName.class); if (l != null && !ServiceLocator.class.equals(l.locator())) { locatorType = l.locator(); } else if (ln != null && ln.locator().length() > 0) { try { locatorType = Class.forName(ln.locator(), false, getTop().getDomainClassLoader()).asSubclass( ServiceLocator.class); } catch (ClassNotFoundException e) { return die(e, "Could not find the locator type specified in the @%s annotation %s", ServiceName.class.getCanonicalName(), ln.value()); } } else { locatorType = null; } return locatorType; }
@Override public Class<?> resolveServiceClass(Class<? extends RequestContext> requestContextClass) { Class<?> searchIn = null; Service s = requestContextClass.getAnnotation(Service.class); if (s != null) { searchIn = s.value(); } ServiceName sn = requestContextClass.getAnnotation(ServiceName.class); if (sn != null) { searchIn = forName(sn.value()); } if (searchIn == null) { die(null, "The %s type %s did not specify a service type", RequestContext.class .getSimpleName(), requestContextClass.getCanonicalName()); } return searchIn; }
private boolean hasServiceLocator(TypeElement x, State state) { Service service = x.getAnnotation(Service.class); if (service != null) { // See javadoc on getAnnotation try { service.locator(); throw new RuntimeException("Should not reach here"); } catch (MirroredTypeException expected) { TypeMirror locatorType = expected.getTypeMirror(); return !state.types.asElement(locatorType).equals(state.serviceLocatorType.asElement()); } } ServiceName serviceName = x.getAnnotation(ServiceName.class); return serviceName != null && !serviceName.locator().isEmpty(); }
@Override public Class<? extends ServiceLocator> resolveServiceLocator( Class<? extends RequestContext> requestContext) { Class<? extends ServiceLocator> locatorType; Service l = requestContext.getAnnotation(Service.class); ServiceName ln = requestContext.getAnnotation(ServiceName.class); if (l != null && !ServiceLocator.class.equals(l.locator())) { locatorType = l.locator(); } else if (ln != null && ln.locator().length() > 0) { try { locatorType = Class.forName(ln.locator(), false, getTop().getDomainClassLoader()).asSubclass( ServiceLocator.class); } catch (ClassNotFoundException e) { return die(e, "Could not find the locator type specified in the @%s annotation %s", ServiceName.class.getCanonicalName(), ln.value()); } } else { locatorType = null; } return locatorType; }
@Override public Class<?> resolveServiceClass(Class<? extends RequestContext> requestContextClass) { Class<?> searchIn = null; Service s = requestContextClass.getAnnotation(Service.class); if (s != null) { searchIn = s.value(); } ServiceName sn = requestContextClass.getAnnotation(ServiceName.class); if (sn != null) { searchIn = forName(sn.value()); } if (searchIn == null) { die(null, "The %s type %s did not specify a service type", RequestContext.class .getSimpleName(), requestContextClass.getCanonicalName()); } return searchIn; }
@Override public Void visitType(TypeElement x, State state) { checkedElement = x; Service service = x.getAnnotation(Service.class); ServiceName serviceName = x.getAnnotation(ServiceName.class); JsonRpcService jsonRpcService = x.getAnnotation(JsonRpcService.class); if (service != null) { poisonIfAnnotationPresent(state, x, serviceName, jsonRpcService); // See javadoc on Element.getAnnotation() for why it works this way try { service.value(); throw new RuntimeException("Should not reach here"); } catch (MirroredTypeException expected) { TypeMirror type = expected.getTypeMirror(); state.addMapping(x, (TypeElement) state.types.asElement(type)); } } if (serviceName != null) { poisonIfAnnotationPresent(state, x, jsonRpcService); TypeElement domain = state.elements.getTypeElement(BinaryName.toSourceName(serviceName.value())); if (domain == null) { state.warn(x, Messages.contextMissingDomainType(serviceName.value())); } state.addMapping(x, domain); } scanAllInheritedMethods(x, state); state.checkExtraTypes(x); return null; }
@Override public Void visitType(TypeElement x, State state) { checkedElement = x; Service service = x.getAnnotation(Service.class); ServiceName serviceName = x.getAnnotation(ServiceName.class); JsonRpcService jsonRpcService = x.getAnnotation(JsonRpcService.class); if (service != null) { poisonIfAnnotationPresent(state, x, serviceName, jsonRpcService); // See javadoc on Element.getAnnotation() for why it works this way try { service.value(); throw new RuntimeException("Should not reach here"); } catch (MirroredTypeException expected) { TypeMirror type = expected.getTypeMirror(); state.addMapping(x, (TypeElement) state.types.asElement(type)); } } if (serviceName != null) { poisonIfAnnotationPresent(state, x, jsonRpcService); TypeElement domain = state.elements.getTypeElement(BinaryName.toSourceName(serviceName.value())); if (domain == null) { state.warn(x, Messages.contextMissingDomainType(serviceName.value())); } state.addMapping(x, domain); } scanAllInheritedMethods(x, state); state.checkExtraTypes(x); return null; }
@Override public Void visitType(TypeElement x, State state) { checkedElement = x; Service service = x.getAnnotation(Service.class); ServiceName serviceName = x.getAnnotation(ServiceName.class); JsonRpcService jsonRpcService = x.getAnnotation(JsonRpcService.class); if (service != null) { poisonIfAnnotationPresent(state, x, serviceName, jsonRpcService); // See javadoc on Element.getAnnotation() for why it works this way try { service.value(); throw new RuntimeException("Should not reach here"); } catch (MirroredTypeException expected) { TypeMirror type = expected.getTypeMirror(); state.addMapping(x, (TypeElement) state.types.asElement(type)); } } if (serviceName != null) { poisonIfAnnotationPresent(state, x, jsonRpcService); TypeElement domain = state.elements.getTypeElement(BinaryName.toSourceName(serviceName.value())); if (domain == null) { state.warn(x, Messages.contextMissingDomainType(serviceName.value())); } state.addMapping(x, domain); } scanAllInheritedMethods(x, state); state.checkExtraTypes(x); return null; }