Package com.google.web.bindery.requestfactory.shared

Examples of com.google.web.bindery.requestfactory.shared.ProxyForName


      } catch (MirroredTypeException expected) {
        TypeMirror locatorType = expected.getTypeMirror();
        return !state.types.asElement(locatorType).equals(state.locatorType.asElement());
      }
    }
    ProxyForName proxyForName = x.getAnnotation(ProxyForName.class);
    return proxyForName != null && !proxyForName.locator().isEmpty();
  }
View Full Code Here


      } catch (MirroredTypeException expected) {
        TypeMirror locatorType = expected.getTypeMirror();
        return !state.types.asElement(locatorType).equals(state.locatorType.asElement());
      }
    }
    ProxyForName proxyForName = x.getAnnotation(ProxyForName.class);
    return proxyForName != null && !proxyForName.locator().isEmpty();
  }
View Full Code Here

  @Override
  public Void visitType(TypeElement x, State state) {
    checkedElement = x;
    ProxyFor proxyFor = x.getAnnotation(ProxyFor.class);
    ProxyForName proxyForName = x.getAnnotation(ProxyForName.class);
    JsonRpcProxy jsonRpcProxy = x.getAnnotation(JsonRpcProxy.class);
    if (proxyFor != null) {
      poisonIfAnnotationPresent(state, x, proxyForName, jsonRpcProxy);

      // See javadoc on Element.getAnnotation() for why it works this way
      try {
        proxyFor.value();
        throw new RuntimeException("Should not reach here");
      } catch (MirroredTypeException expected) {
        TypeMirror type = expected.getTypeMirror();
        state.addMapping(x, (TypeElement) state.types.asElement(type));
      }
    }
    if (proxyForName != null) {
      poisonIfAnnotationPresent(state, x, jsonRpcProxy);
      TypeElement domain =
          state.elements.getTypeElement(BinaryName.toSourceName(proxyForName.value()));
      if (domain == null) {
        state.warn(x, Messages.proxyMissingDomainType(proxyForName.value()));
      }
      state.addMapping(x, domain);
    }

    scanAllInheritedMethods(x, state);
View Full Code Here

    } else if (BaseProxy.class.isAssignableFrom(clazz)) {
      ProxyFor pf = clazz.getAnnotation(ProxyFor.class);
      if (pf != null) {
        return pf.value();
      }
      ProxyForName pfn = clazz.getAnnotation(ProxyForName.class);
      if (pfn != null) {
        Class<?> toReturn = forName(pfn.value());
        return toReturn;
      }
    }
    return die(null, "Could not resolve a domain type for client type %s", clazz.getCanonicalName());
  }
View Full Code Here

        die(poisonedMessage());
      }

      // Get the server domain object type
      ProxyFor proxyFor = entityProxyType.getAnnotation(ProxyFor.class);
      ProxyForName proxyForName = entityProxyType.getAnnotation(ProxyForName.class);
      JsonRpcProxy jsonRpcProxy = entityProxyType.getAnnotation(JsonRpcProxy.class);
      if (proxyFor == null && proxyForName == null && jsonRpcProxy == null) {
        poison("The %s type does not have a @%s, @%s, or @%s annotation", entityProxyType
            .getQualifiedSourceName(), ProxyFor.class.getSimpleName(), ProxyForName.class
            .getSimpleName(), JsonRpcProxy.class.getSimpleName());
View Full Code Here

        die(poisonedMessage());
      }

      // Get the server domain object type
      ProxyFor proxyFor = entityProxyType.getAnnotation(ProxyFor.class);
      ProxyForName proxyForName = entityProxyType.getAnnotation(ProxyForName.class);
      JsonRpcProxy jsonRpcProxy = entityProxyType.getAnnotation(JsonRpcProxy.class);
      if (proxyFor == null && proxyForName == null && jsonRpcProxy == null) {
        poison("The %s type does not have a @%s, @%s, or @%s annotation",
            entityProxyType.getQualifiedSourceName(),
            ProxyFor.class.getSimpleName(), ProxyForName.class.getSimpleName(),
View Full Code Here

    }

    // Check it for annotations
    Class<? extends Locator<?, ?>> locatorType;
    ProxyFor l = proxyType.getAnnotation(ProxyFor.class);
    ProxyForName ln = proxyType.getAnnotation(ProxyForName.class);
    if (l != null && !Locator.class.equals(l.locator())) {
      @SuppressWarnings("unchecked")
      Class<? extends Locator<?, ?>> found = (Class<? extends Locator<?, ?>>) l.locator();
      locatorType = found;
    } else if (ln != null && ln.locator().length() > 0) {
      try {
        @SuppressWarnings("unchecked")
        Class<? extends Locator<?, ?>> found = (Class<? extends Locator<?, ?>>) Class.forName(
            ln.locator(), false, getTop().getDomainClassLoader()).asSubclass(
            Locator.class);
        locatorType = found;
      } catch (ClassNotFoundException e) {
        return die(
            e,
            "Could not find the locator type specified in the @%s annotation %s",
            ProxyForName.class.getCanonicalName(), ln.value());
      }
    } else {
      // No locator annotation
      locatorType = null;
    }
View Full Code Here

    } else if (BaseProxy.class.isAssignableFrom(clazz)) {
      ProxyFor pf = clazz.getAnnotation(ProxyFor.class);
      if (pf != null) {
        return pf.value();
      }
      ProxyForName pfn = clazz.getAnnotation(ProxyForName.class);
      if (pfn != null) {
        Class<?> toReturn = forName(pfn.value());
        return toReturn;
      }
    }
    return die(null, "Could not resolve a domain type for client type %s", clazz.getCanonicalName());
  }
View Full Code Here

      } catch (MirroredTypeException expected) {
        TypeMirror locatorType = expected.getTypeMirror();
        return !state.types.asElement(locatorType).equals(state.locatorType.asElement());
      }
    }
    ProxyForName proxyForName = x.getAnnotation(ProxyForName.class);
    return proxyForName != null && !proxyForName.locator().isEmpty();
  }
View Full Code Here

TOP

Related Classes of com.google.web.bindery.requestfactory.shared.ProxyForName

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.