Package org.eclipse.jdt.core.dom

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


     * @param fieldDeclaration - field declaration
     * @return an ArrayTypeFieldMetadata, that contains information about an array type.
     */
    protected ArrayTypeFieldMetadata processArrayTypeFrom( FieldDeclaration fieldDeclaration ) {
        ArrayTypeFieldMetadata arrayTypeFieldMetadata = null;
        ArrayType arrayType = (ArrayType)fieldDeclaration.getType();
        // the element type is never an array type
        Type type = arrayType.getElementType();
        if (type.isPrimitiveType()) {
            PrimitiveType primitiveType = (PrimitiveType)type;
            arrayTypeFieldMetadata = new ArrayTypeFieldMetadata();
            arrayTypeFieldMetadata.setType(primitiveType.getPrimitiveTypeCode().toString());
            processModifiersAndVariablesOfFieldDeclaration(fieldDeclaration, arrayTypeFieldMetadata);
View Full Code Here


            }
            return parameterizedTypeFieldMetadata;
        }
        if(type.isArrayType()) {
            ArrayTypeFieldMetadata arrayTypeFieldMetadata = new ArrayTypeFieldMetadata();
            ArrayType arrayType = (ArrayType)type;
            arrayTypeFieldMetadata.setType(getTypeName(arrayType));
            variable = new Variable();
            variable.setName(JavaMetadataUtil.getName(singleVariableDeclaration.getName()));
            arrayTypeFieldMetadata.getVariables().add(variable);
           
View Full Code Here

        if (type.isSimpleType()) {
            SimpleType simpleType = (SimpleType)type;
            return JavaMetadataUtil.getName(simpleType.getName());
        }
        if(type.isArrayType()) {
            ArrayType arrayType = (ArrayType)type;
            // the element type is never an array type
            Type elementType = arrayType.getElementType();
            if (elementType.isPrimitiveType()) {
             return ((PrimitiveType)elementType).getPrimitiveTypeCode().toString();

            }
            // can't be an array type
View Full Code Here

     * @param fieldDeclaration - field declaration
     * @return an ArrayTypeFieldMetadata, that contains information about an array type.
     */
    protected ArrayTypeFieldMetadata processArrayTypeFrom( FieldDeclaration fieldDeclaration ) {
        ArrayTypeFieldMetadata arrayTypeFieldMetadata = null;
        ArrayType arrayType = (ArrayType)fieldDeclaration.getType();
        // the element type is never an array type
        Type type = arrayType.getElementType();
        if (type.isPrimitiveType()) {
            PrimitiveType primitiveType = (PrimitiveType)type;
            arrayTypeFieldMetadata = new ArrayTypeFieldMetadata();
            arrayTypeFieldMetadata.setType(primitiveType.getPrimitiveTypeCode().toString());
            processModifiersAndVariablesOfFieldDeclaration(fieldDeclaration, arrayTypeFieldMetadata);
View Full Code Here

    return null;
  }

  public static String asString(Type type) {
    if (type.isArrayType()) {
      ArrayType arrayType = (ArrayType)type;
      return asString(arrayType.getComponentType()) + "[]";
    }
    if (type.isParameterizedType()) {
      ParameterizedType parameterizedType = (ParameterizedType)type;
      List<Type> typeArguments = Generics.asT(parameterizedType.typeArguments());
      class TypeToString implements ClosureUtil.IClosure<Type, String> {
View Full Code Here

        for (final Object dimensionObject : arrayCreation.dimensions()) {
          final ExpressionInfo dimension = new ExpressionInfo((Expression) dimensionObject, null, compilationUnitInfo);
          arrayDeclarator.addArrayModifier(f.newArrayModifier(dimension.getExpression()));
        }
      } else {
        final ArrayType arrayType = (ArrayType) type;
        for (int i = 0; i < arrayType.getDimensions(); i++) {
          arrayDeclarator.addPointerOperator(f.newPointer());
        }
      }
      initializer = null;
      declarator = arrayDeclarator;
View Full Code Here

            result.append('>');
            return result.toString();
        }

        if (type.isArrayType()) {
            final ArrayType arrayType = (ArrayType)type;
            final Type elementType = arrayType.getElementType(); // the element type is never an array type

            if (elementType.isPrimitiveType()) {
                return ((PrimitiveType)elementType).getPrimitiveTypeCode().toString();

            }
View Full Code Here

            LOGGER.debug("Primitive type created at '{0}'", typeNode.getPath());
        } else if (type.isArrayType()) {
            final Node typeNode = parentNode.addNode(typeNodeName, ClassFileSequencerLexicon.ARRAY_TYPE);
            typeNode.setProperty(ClassFileSequencerLexicon.TYPE_CLASS_NAME, getTypeName(type));

            final ArrayType arrayType = ((ArrayType)type);
            typeNode.setProperty(ClassFileSequencerLexicon.DIMENSIONS, arrayType.getDimensions());

            final Type componentType = arrayType.getComponentType();
            record(componentType, ClassFileSequencerLexicon.COMPONENT_TYPE, typeNode);
            LOGGER.debug("Array type created at '{0}'", typeNode.getPath());
        } else if (type.isParameterizedType()) {
            final Node typeNode = parentNode.addNode(typeNodeName, ClassFileSequencerLexicon.PARAMETERIZED_TYPE);
            typeNode.setProperty(ClassFileSequencerLexicon.TYPE_CLASS_NAME, getTypeName(type));
View Full Code Here

                }
            }
            return parameterizedTypeFieldMetadata;
        }
        if (type.isArrayType()) {
            ArrayType arrayType = (ArrayType)type;
            FieldMetadata arrayTypeFieldMetadata = FieldMetadata.arrayType(getTypeName(arrayType));

            variable = new Variable();
            variable.setName(JavaMetadataUtil.getName(singleVariableDeclaration.getName()));
            arrayTypeFieldMetadata.setName(variable.getName());
View Full Code Here

        if (type.isParameterizedType()) {
            ParameterizedType parameterizedType = (ParameterizedType)type;
            return getTypeName(parameterizedType.getType());
        }
        if (type.isArrayType()) {
            ArrayType arrayType = (ArrayType)type;
            // the element type is never an array type
            Type elementType = arrayType.getElementType();
            if (elementType.isPrimitiveType()) {
                return ((PrimitiveType)elementType).getPrimitiveTypeCode().toString();

            }
            // can't be an array type
View Full Code Here

TOP

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

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.