Package com.google.gwt.core.ext.typeinfo

Examples of com.google.gwt.core.ext.typeinfo.JConstructor


    int bodyStart = jmethod.bodyStart;
    int bodyEnd = jmethod.bodyEnd;

    if (jmethod.isConstructor()) {
      name = String.valueOf(enclosingType.getSimpleSourceName());
      method = new JConstructor(enclosingType, name, declStart, declEnd,
          bodyStart, bodyEnd);
    } else {
      name = String.valueOf(jmethod.binding.selector);
      method = new JMethod(enclosingType, name, declStart, declEnd, bodyStart,
          bodyEnd);
View Full Code Here


            source.println( "private native %s create(%s) /*-{", info.getType().getParameterizedQualifiedSourceName(), parametersBuilder
                    .toString() );
            source.indent();

            if ( null != method.isConstructor() ) {
                JConstructor constructor = method.isConstructor();
                source.println( "return %s(%s);", constructor.getJsniSignature(), parametersNameBuilder.toString() );
            } else {
                JMethod factory = method.isMethod();
                source.println( "return %s(%s);", factory.getJsniSignature(), parametersNameBuilder.toString() );
            }

View Full Code Here

        }

        Optional<JClassType> mixinClass = configuration.getMixInAnnotations( beanType );

        // we search for @JsonCreator annotation
        JConstructor creatorDefaultConstructor = null;
        JConstructor creatorConstructor = null;

        // we keep the list containing the mixin creator and the real creator
        List<? extends JAbstractMethod> creators = Collections.emptyList();

        for ( JConstructor constructor : beanType.getConstructors() ) {
            if ( constructor.getParameters().length == 0 ) {
                creatorDefaultConstructor = constructor;
                continue;
            }

            // A constructor is considered as a creator if
            // - he is annotated with JsonCreator and
            //   * all its parameters are annotated with JsonProperty
            //   * or it has only one parameter
            // - or all its parameters are annotated with JsonProperty

            List<JConstructor> constructors = new ArrayList<JConstructor>();
            if ( mixinClass.isPresent() && null == mixinClass.get().isInterface() ) {
                JConstructor mixinConstructor = mixinClass.get().findConstructor( constructor.getParameterTypes() );
                if ( null != mixinConstructor ) {
                    constructors.add( mixinConstructor );
                }
            }
            constructors.add( constructor );
View Full Code Here

    return sb.toString();
  }

  private boolean ctorIsAccessible() {
    JConstructor ctor = serializableClass.findConstructor(new JType[0]);
    if (ctor.isPrivate() || (isJRE && !ctor.isPublic())) {
      return false;
    }
    return true;
  }
View Full Code Here

  }

  private static boolean isInstantiableWithNewOperator (JClassType t) {
    if (!t.isDefaultInstantiable() || t instanceof JArrayType || t instanceof JEnumType) return false;
    try {
      JConstructor constructor = t.getConstructor(new JType[0]);
      return constructor != null && constructor.isPublic();
    } catch (NotFoundException e) {
      return false;
    }
  }
View Full Code Here

  }

  private static boolean isInstantiableWithNewOperator (JClassType t) {
    if (!t.isDefaultInstantiable() || t instanceof JArrayType || t instanceof JEnumType) return false;
    try {
      JConstructor constructor = t.getConstructor(new JType[0]);
      return constructor != null && constructor.isPublic();
    } catch (NotFoundException e) {
      return false;
    }
  }
View Full Code Here

      boolean isDefaultInstantiable = false;
      if (type.getConstructors().length == 0) {
        isDefaultInstantiable = true;
      } else {
        JConstructor ctor = type.findConstructor(new JType[0]);
        if (ctor != null && !ctor.isPrivate()) {
          isDefaultInstantiable = true;
        }
      }

      if (!isDefaultInstantiable) {
View Full Code Here

  }

  protected Visibility createVisibility() {
    Visibility visibility = null;
    while (true) {
      final JConstructor method = this.getJConstructor();
      if (method.isPrivate()) {
        visibility = Visibility.PRIVATE;
        break;
      }
      if (method.isDefaultAccess()) {
        visibility = Visibility.PACKAGE_PRIVATE;
        break;
      }
      if (method.isProtected()) {
        visibility = Visibility.PROTECTED;
        break;
      }
      if (method.isPublic()) {
        visibility = Visibility.PUBLIC;
        break;
      }
      Checker.fail("Unknown visibility for field " + method);
    }
View Full Code Here

    return sb.toString();
  }

  private boolean ctorIsAccessible() {
    JConstructor ctor = serializableClass.findConstructor(new JType[0]);
    if (ctor.isPrivate() || (isJRE && !ctor.isPublic())) {
      return false;
    }
    return true;
  }
View Full Code Here

    // JConstructor/JMethod/JAnnotatedMethod. Then, we'll do a second pass to
    // resolve the bounds on each JTypeParameter object.
    JTypeParameter[] jtypeParameters = resolveTypeParameters(jmethod.typeParameters());

    if (jmethod.isConstructor()) {
      method = new JConstructor(enclosingType, name, declaredAnnotations,
          jtypeParameters);
      // Do a second pass to resolve the bounds on each JTypeParameter.
      if (!resolveBoundsForTypeParameters(logger, method,
          jmethod.typeParameters())) {
        return false;
View Full Code Here

TOP

Related Classes of com.google.gwt.core.ext.typeinfo.JConstructor

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.