Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/java/model/CodeTypeMirror.java @ 16759:23415229349b
Truffle-DSL: new package structure.
author | Christian Humer <christian.humer@gmail.com> |
---|---|
date | Mon, 11 Aug 2014 15:57:14 +0200 |
parents | graal/com.oracle.truffle.dsl.processor/src/com/oracle/truffle/dsl/processor/ast/CodeTypeMirror.java@79041ab43660 |
children | 93e061157811 |
comparison
equal
deleted
inserted
replaced
16758:c5f8eeb3cbc8 | 16759:23415229349b |
---|---|
1 /* | |
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. | |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | |
4 * | |
5 * This code is free software; you can redistribute it and/or modify it | |
6 * under the terms of the GNU General Public License version 2 only, as | |
7 * published by the Free Software Foundation. | |
8 * | |
9 * This code is distributed in the hope that it will be useful, but WITHOUT | |
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | |
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | |
12 * version 2 for more details (a copy is included in the LICENSE file that | |
13 * accompanied this code). | |
14 * | |
15 * You should have received a copy of the GNU General Public License version | |
16 * 2 along with this work; if not, write to the Free Software Foundation, | |
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | |
18 * | |
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | |
20 * or visit www.oracle.com if you need additional information or have any | |
21 * questions. | |
22 */ | |
23 package com.oracle.truffle.dsl.processor.java.model; | |
24 | |
25 import java.lang.annotation.*; | |
26 import java.util.*; | |
27 | |
28 import javax.lang.model.element.*; | |
29 import javax.lang.model.type.*; | |
30 | |
31 public class CodeTypeMirror implements TypeMirror { | |
32 | |
33 private final TypeKind kind; | |
34 | |
35 public CodeTypeMirror(TypeKind kind) { | |
36 this.kind = kind; | |
37 } | |
38 | |
39 @Override | |
40 public TypeKind getKind() { | |
41 return kind; | |
42 } | |
43 | |
44 @Override | |
45 public <R, P> R accept(TypeVisitor<R, P> v, P p) { | |
46 throw new UnsupportedOperationException(); | |
47 } | |
48 | |
49 public static class ArrayCodeTypeMirror extends CodeTypeMirror implements ArrayType { | |
50 | |
51 private final TypeMirror component; | |
52 | |
53 public ArrayCodeTypeMirror(TypeMirror component) { | |
54 super(TypeKind.ARRAY); | |
55 this.component = component; | |
56 } | |
57 | |
58 @Override | |
59 public TypeMirror getComponentType() { | |
60 return component; | |
61 } | |
62 | |
63 } | |
64 | |
65 public static class DeclaredCodeTypeMirror extends CodeTypeMirror implements DeclaredType { | |
66 | |
67 private final TypeElement clazz; | |
68 private final List<? extends TypeMirror> typeArguments; | |
69 | |
70 public DeclaredCodeTypeMirror(TypeElement clazz) { | |
71 this(clazz, Collections.<TypeMirror> emptyList()); | |
72 } | |
73 | |
74 public DeclaredCodeTypeMirror(TypeElement clazz, List<? extends TypeMirror> typeArguments) { | |
75 super(TypeKind.DECLARED); | |
76 this.clazz = clazz; | |
77 this.typeArguments = typeArguments; | |
78 } | |
79 | |
80 @Override | |
81 public Element asElement() { | |
82 return clazz; | |
83 } | |
84 | |
85 @Override | |
86 public TypeMirror getEnclosingType() { | |
87 return clazz.getEnclosingElement().asType(); | |
88 } | |
89 | |
90 @Override | |
91 public List<? extends TypeMirror> getTypeArguments() { | |
92 return typeArguments; | |
93 } | |
94 | |
95 @Override | |
96 public String toString() { | |
97 return clazz.getQualifiedName().toString(); | |
98 } | |
99 | |
100 } | |
101 | |
102 public List<? extends AnnotationMirror> getAnnotationMirrors() { | |
103 throw new UnsupportedOperationException(); | |
104 } | |
105 | |
106 /** | |
107 * @param annotationType | |
108 */ | |
109 public <A extends Annotation> A getAnnotation(Class<A> annotationType) { | |
110 throw new UnsupportedOperationException(); | |
111 } | |
112 | |
113 /** | |
114 * @param annotationType | |
115 */ | |
116 public <A extends Annotation> A[] getAnnotationsByType(Class<A> annotationType) { | |
117 throw new UnsupportedOperationException(); | |
118 } | |
119 } |