Package com.google.java.contract.core.model

Examples of com.google.java.contract.core.model.VariableModel


    }

    append("(");
    Iterator<? extends VariableModel> it = method.getParameters().iterator();
    if (it.hasNext()) {
      VariableModel param = it.next();
      while (it.hasNext()) {
        appendVariableDeclaration(param);
        append(", ");
        param = it.next();
      }
      if (!method.isVariadic()) {
        appendVariableDeclaration(param);
      } else {
        String variadicTypeName =
            VARIADIC_REGEX.matcher(param.getType().getDeclaredName())
            .replaceFirst("...");
        appendVariableDeclaration(param, variadicTypeName);
      }
    }
    append(")");
View Full Code Here


        if (oldBuffer != null) {
          if (newLevel == oldContext) {
            /* End of old expression. */
            String oldExpr = oldBuffer.toString();
            oldParameters.add(
                new VariableModel(ElementKind.PARAMETER, oldName,
                                  new ClassName("java/lang/Object")));
            oldParametersCode.add(oldExpr);
            oldParametersLineNumbers.add(lineNumber);

            /* Pad buffer (for error reporting purposes). */
 
View Full Code Here

  })
  public static void copyParameters(MethodModel method,
                                    List<? extends VariableModel> parameters) {
    ArrayList<VariableModel> list = new ArrayList<VariableModel>(parameters);
    for (VariableModel param : list) {
      method.addParameter(new VariableModel(param));
    }
  }
View Full Code Here

      }
    }

    if (!annotation.isVirtual()) {
      method.addParameter(
          new VariableModel(ElementKind.PARAMETER,
                            JavaUtils.THAT_VARIABLE, annotation.getOwner()));
    }

    if (!annotation.isVirtual()) {
      method.addModifier(ElementModifier.PUBLIC);
View Full Code Here

                     : "void");
    method.setReturnType(returnType);

    if (kind.getVariance() == ContractVariance.CONTRAVARIANT) {
      method.addParameter(
          new VariableModel(ElementKind.PARAMETER,
                            JavaUtils.ERROR_VARIABLE, returnType));
    }

    if (annotation.isPrimary()) {
      method.setSourceInfo(annotation.getSourceInfo());
View Full Code Here

  }

  @Requires("type != null")
  @Ensures("result != null")
  private static VariableModel getResultVariable(TypeName type) {
    VariableModel var =
        new VariableModel(ElementKind.PARAMETER, JavaUtils.RESULT_VARIABLE,
                          type);
    var.addModifier(ElementModifier.FINAL);
    return var;
  }
View Full Code Here

    return var;
  }

  @Ensures("result != null")
  private static VariableModel getSignalVariable() {
    VariableModel var =
        new VariableModel(ElementKind.PARAMETER, JavaUtils.SIGNAL_VARIABLE,
                          new ClassName("java/lang/Exception"));
    var.addModifier(ElementModifier.FINAL);
    return var;
  }
View Full Code Here

          kind = ElementKind.FIELD;
        } else {
          kind = ElementKind.PARAMETER;
        }
    }
    VariableModel variable =
        new VariableModel(kind, e.getSimpleName().toString(),
                          utils.getTypeNameForType(e.asType()));
    utils.copyModifiers(e, variable);

    scanAnnotations(e, true, type.getName(), variable);
View Full Code Here

TOP

Related Classes of com.google.java.contract.core.model.VariableModel

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.