KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > compiler > apt > model > ArrayTypeImpl


1 /*******************************************************************************
2  * Copyright (c) 2007 BEA Systems, Inc.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * wharley@bea.com - initial API and implementation
10  *
11  *******************************************************************************/

12
13 package org.eclipse.jdt.internal.compiler.apt.model;
14
15 import javax.lang.model.type.ArrayType;
16 import javax.lang.model.type.TypeKind;
17 import javax.lang.model.type.TypeMirror;
18 import javax.lang.model.type.TypeVisitor;
19
20 import org.eclipse.jdt.internal.compiler.apt.dispatch.BaseProcessingEnvImpl;
21 import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding;
22
23 /**
24  * Implementation of ArrayType, which represents an array of some type.
25  */

26 public class ArrayTypeImpl extends TypeMirrorImpl implements ArrayType {
27     
28     ArrayTypeImpl(BaseProcessingEnvImpl env, ArrayBinding binding) {
29         super(env, binding);
30     }
31
32     /* (non-Javadoc)
33      * @see javax.lang.model.type.ArrayType#getComponentType()
34      */

35     @Override JavaDoc
36     public TypeMirror getComponentType() {
37         return _env.getFactory().newTypeMirror(((ArrayBinding)_binding).elementsType());
38     }
39
40     /* (non-Javadoc)
41      * @see javax.lang.model.type.TypeMirror#accept(javax.lang.model.type.TypeVisitor, java.lang.Object)
42      */

43     @Override JavaDoc
44     public <R, P> R accept(TypeVisitor<R, P> v, P p) {
45         return v.visitArray(this, p);
46     }
47     
48     /* (non-Javadoc)
49      * @see javax.lang.model.type.TypeMirror#getKind()
50      */

51     @Override JavaDoc
52     public TypeKind getKind() {
53         return TypeKind.ARRAY;
54     }
55 }
56
Popular Tags