Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: e9f51b48b7f6d94e31f7703c50ab93382a9b9461 (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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/*******************************************************************************
 * Copyright (c) 2009 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.core.internal.jpa2.resource.java.binary;

import java.util.ListIterator;
import java.util.Vector;

import org.eclipse.jdt.core.IAnnotation;
import org.eclipse.jpt.core.internal.resource.java.binary.BinaryAnnotation;
import org.eclipse.jpt.core.jpa2.resource.java.GeneratedAnnotation;
import org.eclipse.jpt.core.resource.java.JavaResourcePersistentType;
import org.eclipse.jpt.utility.internal.iterators.CloneListIterator;

/**
 * javax.annotation.Generated
 */
public final class BinaryGeneratedAnnotation
	extends BinaryAnnotation
	implements GeneratedAnnotation
{
	private final Vector<String> values;
	private String date;
	private String comments;


	public BinaryGeneratedAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) {
		super(parent, jdtAnnotation);
		this.values = this.buildValues();
		this.date = this.buildDate();
		this.comments = this.buildComments();
	}

	public String getAnnotationName() {
		return ANNOTATION_NAME;
	}

	@Override
	public void update() {
		super.update();
		this.updateValues();
		this.setDate_(this.buildDate());
		this.setComments_(this.buildComments());
	}

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


	// ********** GeneratedAnnotation implementation **********

	// ***** values
	public ListIterator<String> values() {
		return new CloneListIterator<String>(this.values);
	}

	public int valuesSize() {
		return this.values.size();
	}

	public String getValue(int index) {
		return this.values.get(index);
	}

	private Vector<String> buildValues() {
		Object[] jdtValues = this.getJdtMemberValues(VALUE_ELEMENT_NAME);
		Vector<String> result = new Vector<String>(jdtValues.length);
		for (Object value : jdtValues) {
			result.add((String) value);
		}
		return result;
	}

	public void addValue(String value) {
		throw new UnsupportedOperationException();
	}

	public void addValue(int index, String value) {
		throw new UnsupportedOperationException();
	}

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

	public void removeValue(String value) {
		throw new UnsupportedOperationException();
	}

	public void removeValue(int index) {
		throw new UnsupportedOperationException();
	}

	// ***** date
	public String getDate() {
		return this.date;
	}

	public void setDate(String date) {
		throw new UnsupportedOperationException();
	}

	private void setDate_(String date) {
		String old = this.date;
		this.date = date;
		this.firePropertyChanged(DATE_PROPERTY, old, date);
	}

	private String buildDate() {
		return (String) this.getJdtMemberValue(DATE_ELEMENT_NAME);
	}

	// ***** comments
	public String getComments() {
		return this.comments;
	}

	public void setComments(String comments) {
		throw new UnsupportedOperationException();
	}

	private void setComments_(String comments) {
		String old = this.comments;
		this.comments = comments;
		this.firePropertyChanged(COMMENTS_PROPERTY, old, comments);
	}

	private String buildComments() {
		return (String) this.getJdtMemberValue(COMMENTS_ELEMENT_NAME);
	}

}

Back to the top