src/share/classes/com/sun/tools/javadoc/AnnotatedTypeImpl.java

Mon, 25 Mar 2013 16:55:14 -0700

author
mfang
date
Mon, 25 Mar 2013 16:55:14 -0700
changeset 1658
fdf30b225e1c
parent 1521
71f35e4b93a5
child 1992
23f0f3c9c44a
permissions
-rw-r--r--

8010521: jdk8 l10n resource file translation update 2
Reviewed-by: naoto, yhuang

jjg@1521 1 /*
jjg@1521 2 * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
jjg@1521 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
jjg@1521 4 *
jjg@1521 5 * This code is free software; you can redistribute it and/or modify it
jjg@1521 6 * under the terms of the GNU General Public License version 2 only, as
jjg@1521 7 * published by the Free Software Foundation. Oracle designates this
jjg@1521 8 * particular file as subject to the "Classpath" exception as provided
jjg@1521 9 * by Oracle in the LICENSE file that accompanied this code.
jjg@1521 10 *
jjg@1521 11 * This code is distributed in the hope that it will be useful, but WITHOUT
jjg@1521 12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
jjg@1521 13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
jjg@1521 14 * version 2 for more details (a copy is included in the LICENSE file that
jjg@1521 15 * accompanied this code).
jjg@1521 16 *
jjg@1521 17 * You should have received a copy of the GNU General Public License version
jjg@1521 18 * 2 along with this work; if not, write to the Free Software Foundation,
jjg@1521 19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
jjg@1521 20 *
jjg@1521 21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
jjg@1521 22 * or visit www.oracle.com if you need additional information or have any
jjg@1521 23 * questions.
jjg@1521 24 */
jjg@1521 25
jjg@1521 26 package com.sun.tools.javadoc;
jjg@1521 27
jjg@1521 28 import com.sun.javadoc.*;
jjg@1521 29 import com.sun.tools.javac.code.Attribute;
jjg@1521 30 import com.sun.tools.javac.code.Attribute.TypeCompound;
jjg@1521 31 import com.sun.tools.javac.util.List;
jjg@1521 32
jjg@1521 33 /**
jjg@1521 34 * Implementation of <code>AnnotatedType</code>, which
jjg@1521 35 * represents an annotated type.
jjg@1521 36 *
jjg@1521 37 * @author Mahmood Ali
jjg@1521 38 * @since 1.8
jjg@1521 39 */
jjg@1521 40 public class AnnotatedTypeImpl
jjg@1521 41 extends AbstractTypeImpl implements AnnotatedType {
jjg@1521 42
jjg@1521 43 AnnotatedTypeImpl(DocEnv env, com.sun.tools.javac.code.Type.AnnotatedType type) {
jjg@1521 44 super(env, type);
jjg@1521 45 }
jjg@1521 46
jjg@1521 47 /**
jjg@1521 48 * Get the annotations of this program element.
jjg@1521 49 * Return an empty array if there are none.
jjg@1521 50 */
jjg@1521 51 @Override
jjg@1521 52 public AnnotationDesc[] annotations() {
jjg@1521 53 List<TypeCompound> tas = ((com.sun.tools.javac.code.Type.AnnotatedType)type).typeAnnotations;
jjg@1521 54 if (tas == null ||
jjg@1521 55 tas.isEmpty()) {
jjg@1521 56 return new AnnotationDesc[0];
jjg@1521 57 }
jjg@1521 58 AnnotationDesc res[] = new AnnotationDesc[tas.length()];
jjg@1521 59 int i = 0;
jjg@1521 60 for (Attribute.Compound a : tas) {
jjg@1521 61 res[i++] = new AnnotationDescImpl(env, a);
jjg@1521 62 }
jjg@1521 63 return res;
jjg@1521 64 }
jjg@1521 65
jjg@1521 66 @Override
jjg@1521 67 public com.sun.javadoc.Type underlyingType() {
jjg@1521 68 return TypeMaker.getType(env, ((com.sun.tools.javac.code.Type.AnnotatedType)type).underlyingType, true, false);
jjg@1521 69 }
jjg@1521 70
jjg@1521 71 @Override
jjg@1521 72 public AnnotatedType asAnnotatedType() {
jjg@1521 73 return this;
jjg@1521 74 }
jjg@1521 75
jjg@1521 76 @Override
jjg@1521 77 public String toString() {
jjg@1521 78 return typeName();
jjg@1521 79 }
jjg@1521 80
jjg@1521 81 @Override
jjg@1521 82 public String typeName() {
jjg@1521 83 return this.underlyingType().typeName();
jjg@1521 84 }
jjg@1521 85
jjg@1521 86 @Override
jjg@1521 87 public String qualifiedTypeName() {
jjg@1521 88 return this.underlyingType().qualifiedTypeName();
jjg@1521 89 }
jjg@1521 90
jjg@1521 91 @Override
jjg@1521 92 public String simpleTypeName() {
jjg@1521 93 return this.underlyingType().simpleTypeName();
jjg@1521 94 }
jjg@1521 95
jjg@1521 96 @Override
jjg@1521 97 public String dimension() {
jjg@1521 98 return this.underlyingType().dimension();
jjg@1521 99 }
jjg@1521 100
jjg@1521 101 @Override
jjg@1521 102 public boolean isPrimitive() {
jjg@1521 103 return this.underlyingType().isPrimitive();
jjg@1521 104 }
jjg@1521 105
jjg@1521 106 @Override
jjg@1521 107 public ClassDoc asClassDoc() {
jjg@1521 108 return this.underlyingType().asClassDoc();
jjg@1521 109 }
jjg@1521 110
jjg@1521 111 @Override
jjg@1521 112 public TypeVariable asTypeVariable() {
jjg@1521 113 return this.underlyingType().asTypeVariable();
jjg@1521 114 }
jjg@1521 115
jjg@1521 116 @Override
jjg@1521 117 public WildcardType asWildcardType() {
jjg@1521 118 return this.underlyingType().asWildcardType();
jjg@1521 119 }
jjg@1521 120
jjg@1521 121 @Override
jjg@1521 122 public ParameterizedType asParameterizedType() {
jjg@1521 123 return this.underlyingType().asParameterizedType();
jjg@1521 124 }
jjg@1521 125 }

mercurial