Ben Dodson | 920dbbb | 2010-08-04 15:21:06 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2010 Google Inc. |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | package com.google.doclava; |
| 18 | |
| 19 | public class AnnotationInstanceInfo { |
| 20 | private ClassInfo mType; |
| 21 | private AnnotationValueInfo[] mElementValues; |
| 22 | |
| 23 | public AnnotationInstanceInfo(ClassInfo type, AnnotationValueInfo[] elementValues) { |
| 24 | mType = type; |
| 25 | mElementValues = elementValues; |
| 26 | } |
| 27 | |
| 28 | ClassInfo type() { |
| 29 | return mType; |
| 30 | } |
| 31 | |
| 32 | AnnotationValueInfo[] elementValues() { |
| 33 | return mElementValues; |
| 34 | } |
| 35 | |
| 36 | @Override |
| 37 | public String toString() { |
| 38 | StringBuilder str = new StringBuilder(); |
| 39 | str.append("@"); |
| 40 | str.append(mType.qualifiedName()); |
| 41 | str.append("("); |
| 42 | AnnotationValueInfo[] values = mElementValues; |
| 43 | final int N = values.length; |
| 44 | for (int i = 0; i < N; i++) { |
| 45 | AnnotationValueInfo value = values[i]; |
| 46 | str.append(value.element().name()); |
| 47 | str.append("="); |
| 48 | str.append(value.valueString()); |
| 49 | if (i != N - 1) { |
| 50 | str.append(","); |
| 51 | } |
| 52 | } |
| 53 | str.append(")"); |
| 54 | return str.toString(); |
| 55 | } |
| 56 | } |