Skip to main content
summaryrefslogtreecommitdiffstats
blob: 46030000576122e2fb26f5467f00585690dda9df (plain) (blame)
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
/*******************************************************************************
 * Copyright (c) 2010 Oracle. All rights reserved.
 * This program and the accompanying materials are made available under the
 * terms of the Eclipse Public License v1.0, which accompanies this distribution
 * and is available at http://www.eclipse.org/legal/epl-v10.html.
 * 
 * Contributors:
 *     Oracle - initial API and implementation
 ******************************************************************************/
package org.eclipse.jpt.jaxb.core.internal.resource.java.binary;

import java.util.Vector;
import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jpt.common.utility.internal.iterables.ListIterable;
import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable;
import org.eclipse.jpt.jaxb.core.resource.java.JAXB;
import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAbstractType;
import org.eclipse.jpt.jaxb.core.resource.java.XmlSeeAlsoAnnotation;

/**
 * javax.xml.bind.annotation.XmlSeeAlso
 */
public final class BinaryXmlSeeAlsoAnnotation
		extends BinaryAnnotation
		implements XmlSeeAlsoAnnotation {
	
	private final Vector<String> classes;


	public BinaryXmlSeeAlsoAnnotation(JavaResourceAbstractType parent, IAnnotation jdtAnnotation) {
		super(parent, jdtAnnotation);
		this.classes = this.buildClasses();
	}

	public String getAnnotationName() {
		return ANNOTATION_NAME;
	}

	@Override
	public void update() {
		super.update();
		this.updateClasses();
	}

	@Override
	public void toString(StringBuilder sb) {
		sb.append(this.classes);
	}


	// ********** XmlSeeAlsoAnnotation implementation **********

	// ***** value
	public ListIterable<String> getClasses() {
		return new LiveCloneListIterable<String>(this.classes);
	}

	public int getClassesSize() {
		return this.classes.size();
	}

	private Vector<String> buildClasses() {
		Object[] jdtClasses = this.getJdtMemberValues(JAXB.XML_SEE_ALSO__VALUE);
		Vector<String> result = new Vector<String>(jdtClasses.length);
		for (Object jdtClass : jdtClasses) {
			result.add((String) jdtClass);
		}
		return result;
	}

	public void addClass(String clazz) {
		throw new UnsupportedOperationException();
	}

	public void addClass(int index, String clazz) {
		throw new UnsupportedOperationException();
	}

	public void moveClass(int targetIndex, int sourceIndex) {
		throw new UnsupportedOperationException();
	}

	public void removeClass(String clazz) {
		throw new UnsupportedOperationException();
	}

	public void removeClass(int index) {
		throw new UnsupportedOperationException();
	}
	
	public ListIterable<String> getFullyQualifiedClasses() {
		return getClasses();
	}

	// TODO
	private void updateClasses() {
		throw new UnsupportedOperationException();
	}

}

Back to the top