Package org.eclipse.jdt.core.dom

Examples of org.eclipse.jdt.core.dom.NumberLiteral


    final Expression leftExpCopy = (Expression) ASTNode.copySubtree(ast, ie
        .getLeftOperand());
    final Expression rightExpCopy = (Expression) ASTNode.copySubtree(ast,
        ie.getRightOperand());

    final NumberLiteral zero = ast.newNumberLiteral();
    astRewrite.replace(ie.getRightOperand(), zero, null);

    final MethodInvocation newInvocation = ast.newMethodInvocation();
    newInvocation.setExpression(leftExpCopy);
    newInvocation.setName(ast.newSimpleName("compareTo")); //$NON-NLS-1$
View Full Code Here


      TypeDeclaration td) {
    VariableDeclarationFragment fragment = ast
        .newVariableDeclarationFragment();
    SimpleName variableName = ast.newSimpleName("serialVersionUID");
    fragment.setName(variableName);
    NumberLiteral initializer = ast.newNumberLiteral();
    initializer.setToken("1L");
    fragment.setInitializer(initializer);

    FieldDeclaration fieldDeclaration = ast.newFieldDeclaration(fragment);
    fieldDeclaration.modifiers().add(
        ast.newModifier(Modifier.ModifierKeyword.PRIVATE_KEYWORD));
View Full Code Here

  void chooseLiteralTypeAndAddToEnumConstantArguments(AST ast,
      EnumConstantDeclaration ec, Slot slot, Type type) {
    EList<ValueSpecification> valueSpecifications = slot.getValues();
    for (ValueSpecification valueSpecification : valueSpecifications) {
      if (type.getName().equalsIgnoreCase("Integer")) {
        NumberLiteral numberLiteral = ast.newNumberLiteral();
        numberLiteral.setToken(String.valueOf(valueSpecification
            .integerValue()));
        ec.arguments().add(numberLiteral);
      } else if (type.getName().equalsIgnoreCase("Long")) {
        NumberLiteral numberLiteral = ast.newNumberLiteral();
        numberLiteral.setToken(String.valueOf(
            valueSpecification.integerValue()).concat("L"));
        ec.arguments().add(numberLiteral);
      } else if (type.getName().equalsIgnoreCase("Boolean")) {
        BooleanLiteral booleanLiteral = ast
            .newBooleanLiteral(valueSpecification.booleanValue());
View Full Code Here

//      case ASTNode.METHOD_INVOCATION:
//        return "Method invocation";
//      case ASTNode.NULL_LITERAL:
//        return "Null literal";
      case ASTNode.NUMBER_LITERAL:
        NumberLiteral numberLiteral = (NumberLiteral) node;
        String token = numberLiteral.getToken();
        try {
          return Integer.parseInt(token);
        } catch(Exception ex) {}
        try {
          return Long.parseLong(token);
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.core.dom.NumberLiteral

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.