Package com.google.web.bindery.autobean.shared.AutoBean

Examples of com.google.web.bindery.autobean.shared.AutoBean.PropertyName


    }
  }

  static String getEnumName(JEnumConstant e) {
    String name;
    PropertyName annotation = e.getAnnotation(PropertyName.class);
    if (annotation == null) {
      name = e.getName();
    } else {
      name = annotation.value();
    }
    return name;
  }
View Full Code Here


    public AutoBeanMethod build() {
      if (toReturn.action.equals(JBeanMethod.GET)
          || toReturn.action.equals(JBeanMethod.SET)
          || toReturn.action.equals(JBeanMethod.SET_BUILDER)) {
        PropertyName annotation = toReturn.method.getAnnotation(PropertyName.class);
        if (annotation != null) {
          toReturn.propertyName = annotation.value();
        } else {
          toReturn.propertyName = toReturn.action.inferName(toReturn.method);
        }
      }
View Full Code Here

         * Only support extra properties in JSON-RPC payloads. Could add this to
         * standard requests to provide out-of-band data.
         */
        if (method.getDialect().equals(Dialect.JSON_RPC)) {
          for (JMethod setter : request.getExtraSetters()) {
            PropertyName propertyNameAnnotation = setter.getAnnotation(PropertyName.class);
            String propertyName = propertyNameAnnotation == null
                ? JBeanMethod.SET.inferName(setter)
                : propertyNameAnnotation.value();
            String maybeReturn = JBeanMethod.SET_BUILDER.matches(setter)
                ? "return this;" : "";
            sw.println(
                "%s { getRequestData().setNamedParameter(\"%s\", %s); %s}",
                setter.getReadableDeclaration(false, false, false, false, true),
                propertyName, setter.getParameters()[0].getName(), maybeReturn);
          }
        }

        // end class X{}
        sw.outdent();
        sw.println("}");

        // Instantiate, enqueue, and return
        sw.println("X x = new X();");

        if (request.getApiVersion() != null) {
          sw.println("x.getRequestData().setApiVersion(\"%s\");",
              Generator.escape(request.getApiVersion()));
        }

        // JSON-RPC payloads send their parameters in a by-name fashion
        if (method.getDialect().equals(Dialect.JSON_RPC)) {
          for (JParameter param : jmethod.getParameters()) {
            PropertyName annotation = param.getAnnotation(PropertyName.class);
            String propertyName = annotation == null ? param.getName()
                : annotation.value();
            boolean isContent = param.isAnnotationPresent(JsonRpcContent.class);
            if (isContent) {
              sw.println("x.getRequestData().setRequestContent(%s);",
                  param.getName());
            } else {
View Full Code Here

TOP

Related Classes of com.google.web.bindery.autobean.shared.AutoBean.PropertyName

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.