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; }
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(); }
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(); }
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<? 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<? 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; }