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

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


    }
    return false;
  }

  private boolean hasProxyLocator(TypeElement x, State state) {
    ProxyFor proxyFor = x.getAnnotation(ProxyFor.class);
    if (proxyFor != null) {
      // See javadoc on getAnnotation
      try {
        proxyFor.locator();
        throw new RuntimeException("Should not reach here");
      } catch (MirroredTypeException expected) {
        TypeMirror locatorType = expected.getTypeMirror();
        return !state.types.asElement(locatorType).equals(state.locatorType.asElement());
      }
View Full Code Here


    }
    return returnType;
  }

  private boolean hasProxyLocator(TypeElement x, State state) {
    ProxyFor proxyFor = x.getAnnotation(ProxyFor.class);
    if (proxyFor != null) {
      // See javadoc on getAnnotation
      try {
        proxyFor.locator();
        throw new RuntimeException("Should not reach here");
      } catch (MirroredTypeException expected) {
        TypeMirror locatorType = expected.getTypeMirror();
        return !state.types.asElement(locatorType).equals(state.locatorType.asElement());
      }
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));
      }
View Full Code Here

    } else if (Set.class.equals(clazz)) {
      return Set.class;
    } else if (Map.class.equals(clazz)) {
      return Map.class;
    } 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;
View Full Code Here

        // Cannot continue, since knowing the behavior is crucial
        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
View Full Code Here

        // Since we use a EntityProxy this method must be present.
        assertNotNull(proxyClass.getMethod("stableId"));

        assertTrue(EntityProxy.class.isAssignableFrom(EmployeeProxy.class));

        ProxyFor proxyAnnotation = EmployeeProxy.class.getAnnotation(ProxyFor.class);
        assertEquals(proxyAnnotation.value(), Employee.class);
        assertEquals(proxyAnnotation.locator(), EmployeeLocator.class);
    }
View Full Code Here

        assertTrue(parameterTypes[0].isAssignableFrom(Set.class));
    }

    @Test
    public void shouldGenerateValueProxy() throws NoSuchMethodException {
        ProxyFor proxyAnnotation = AddressProxy.class.getAnnotation(ProxyFor.class);
        assertTrue(ValueProxy.class.isAssignableFrom(AddressProxy.class));
        assertEquals(proxyAnnotation.value(), Address.class);
    }
View Full Code Here

        // Cannot continue, since knowing the behavior is crucial
        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(),
View Full Code Here

      return null;
    }

    // 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(
View Full Code Here

    if (List.class.equals(clazz)) {
      return List.class;
    } else if (Set.class.equals(clazz)) {
      return Set.class;
    } 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;
View Full Code Here

TOP

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

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.