aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ArrayAnnotationValue.java
blob: ba2ed7c83f3ce54a1c8c2895e4e0010bb7f60e5e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
/* *******************************************************************
 * Copyright (c) 2006 Contributors
 * All rights reserved.
 * This program and the accompanying materials are made available
 * under the terms of the Eclipse Public License v 2.0
 * which accompanies this distribution and is available at
 * https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
 *
 * Contributors:
 *     Andy Clement IBM     initial implementation
 * ******************************************************************/
package org.aspectj.weaver;

public class ArrayAnnotationValue extends AnnotationValue {

	private AnnotationValue[] values;

	public ArrayAnnotationValue() {
		super(AnnotationValue.ARRAY);
	}

	public void setValues(AnnotationValue[] values) {
		this.values = values;
	}

	public ArrayAnnotationValue(AnnotationValue[] values) {
		super(AnnotationValue.ARRAY);
		this.values = values;
	}

	public AnnotationValue[] getValues() {
		return values;
	}

	public String stringify() {
		StringBuilder sb = new StringBuilder();
		sb.append("[");
		for (int i = 0; i < values.length; i++) {
			sb.append(values[i].stringify());
			if (i + 1 < values.length)
				sb.append(",");
		}
		sb.append("]");
		return sb.toString();
	}

	public String toString() {
		StringBuilder sb = new StringBuilder();
		sb.append("{");
		for (int i = 0; i < values.length; i++) {
			sb.append(values[i].toString());
			if ((i + 1) < values.length)
				sb.append(",");
		}
		sb.append("}");
		return sb.toString();
	}

}