Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 81650c62b68f78722bdf80637157f496fec8bea5 (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
/**
 * <copyright>
 *
 * Copyright (c) 2005, 2006, 2007, 2008 Springsite BV (The Netherlands) and others
 * 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:
 *   Martin Taal
 * </copyright>
 *
 * $Id: PrimitiveValueNode.java,v 1.5 2008/06/10 10:19:43 mtaal Exp $
 */

package org.eclipse.emf.teneo.annotations.parser;

/**
 * Simple value node.
 * 
 * @author <a href="mailto:mtaal at elver.org">Martin Taal</a>
 */
class PrimitiveValueNode extends NamedParserNode {

	/** The value */
	private String value;

	/**
	 * @return the value
	 */
	public String getValue() {
		return value;
	}

	/**
	 * @param value
	 *          the value to set
	 */
	public void setValue(String value) {
		value = value.replaceAll("&gt;", ">");
		value = value.replaceAll("&lt;", "<");

		// correct a small mistake in the tokenizer
		if (value != null && value.length() > 1 && value.charAt(0) == '"'
				&& value.charAt(value.length() - 1) == '"') {
			this.value = value.substring(1, value.length() - 1);
		} else {
			this.value = value;
		}
	}

	/** Translate into an etype */
	@Override
	Object convert(EClassResolver ecr) {
		return value;
	}

}

Back to the top