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

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


    typeParamLookup.pushScope(typeParams);
    boolean hasReturnType = true;
    if ("<init>".equals(name)) {
      name = type.getSimpleSourceName();
      method = new JConstructor(type, name, declaredAnnotations, typeParams);
      hasReturnType = false;
    } else {
      if (type.isAnnotation() != null) {
        // TODO(jat): !! anything else to do here?
        method = new JAnnotationMethod(type, name, typeParams,
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

    // 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

    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

    JClassType objectType = typeOracle.findType(CU_Object.getTypeName());
    assertNotNull(objectType);
    assertEquals("Object", objectType.getSimpleSourceName());
    JConstructor[] ctors = objectType.getConstructors();
    assertEquals(1, ctors.length);
    JConstructor defaultCtor = ctors[0];
    assertEquals("Object", defaultCtor.getName());
    assertEquals(0, defaultCtor.getParameters().length);
  }
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

   * @param enclosingType the type to which the constructor belongs
   * @return the GWT constructor
   */
  private JConstructor adaptConstructor(final Constructor<?> realConstructor,
      JClassType enclosingType) {
    final JConstructor constructor = createMock(JConstructor.class);

    addCommonAbstractMethodBehaviour(realConstructor, constructor,
        enclosingType);
    addAnnotationBehaviour(realConstructor, constructor);

    // Parameters
    when(constructor.getParameters()).thenAnswer(
        new Answer<JParameter[]>() {
          @Override
          public JParameter[] answer(InvocationOnMock invocation) throws Throwable {
            return adaptParameters(realConstructor.getParameterTypes(),
                realConstructor.getParameterAnnotations(), constructor);
          }
        });

    // Thrown exceptions
    when(constructor.getThrows()).thenAnswer(
        new Answer<JClassType[]>() {
          @Override
          public JClassType[] answer(InvocationOnMock invocation) throws Throwable {
            Class<?>[] realThrows = realConstructor.getExceptionTypes();
            JClassType[] gwtThrows = new JClassType[realThrows.length];
View Full Code Here

    JClassType constructorsType = gwtTypeAdapter.adaptJavaClass(UiConstructorClass.class);
    OwnerFieldClass constructorsClass = OwnerFieldClass.getFieldClass(
        constructorsType, MortalLogger.NULL, uiBinderCtx);
    assertEquals(constructorsType, constructorsClass.getRawType());

    JConstructor constructor = constructorsClass.getUiConstructor();
    assertNotNull(constructor);
    assertEquals(constructorsType, constructor.getEnclosingType());

    JParameter[] parameters = constructor.getParameters();
    assertEquals(1, parameters.length);
    assertEquals(JPrimitiveType.BOOLEAN, parameters[0].getType());
  }
View Full Code Here

                if (possibleType.clazz.isEnum() != null) {
                    generateEnumEncodeMethodBody(possibleType, typeInfo);
                } else {

                    // Try to find a constuctor that is annotated as creator
                    final JConstructor creator = findCreator(possibleType.clazz);

                    List<JField> orderedFields = creator == null ? null : getOrderedFields(getFields(possibleType.clazz), creator);

                    if (typeInfo != null) {
                        switch (typeInfo.include()) {
View Full Code Here

                if (possibleType.clazz.isEnum() != null) {
                    generateEnumDecodeMethodBody(possibleType.clazz);
                } else {
                    // Try to find a constuctor that is annotated as creator
                    final JConstructor creator = findCreator(possibleType.clazz);

                    List<JField> orderedFields = null;
                    if (creator != null) {
                        p("// We found a creator so we use the annotated constructor");
                        p("" + possibleType.clazz.getParameterizedQualifiedSourceName() + " rc = new " + possibleType.clazz.getParameterizedQualifiedSourceName() + "(");
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.