Skip to main content
summaryrefslogtreecommitdiffstats
blob: ff7b75ce84719f8d2c185c609a1ccb5de3998eba (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
/*******************************************************************************
 * Copyright (c) 2004, 2007 IBM Corporation 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:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jst.jsp.core.internal.contentmodel.tld;

import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.JSP12TLDNames;
import org.eclipse.jst.jsp.core.internal.contentmodel.tld.provisional.TLDVariable;
import org.eclipse.wst.sse.core.utils.StringUtils;


public class TLDVariableImpl implements TLDVariable {
	// optional - defaults to true
	private boolean declare = true;

	private String fDescription;
	// required
	private String nameFromAttribute;
	// required
	private String nameGiven;
	// optional - defaults to NESTED
	private String scope = JSP12TLDNames.VARIABLE_SCOPE_NESTED;
	// required - defaults to a String
	private String variableClass = "java.lang.String"; //$NON-NLS-1$

	private String fAlias;

	public boolean getDeclare() {
		return declare;
	}

	/**
	 * @return Returns the description.
	 */
	public String getDescription() {
		return fDescription;
	}

	public String getNameFromAttribute() {
		return nameFromAttribute;
	}

	public String getNameGiven() {
		return nameGiven;
	}

	public String getScope() {
		return scope;
	}

	public String getVariableClass() {
		return variableClass;
	}

	public void setDeclare(boolean declare) {
		this.declare = declare;
	}

	public void setDeclareString(String decl) {
		if (decl != null) {
			setDeclare(decl.equals(JSP12TLDNames.TRUE) || decl.equals(JSP12TLDNames.YES));
		}
	}

	/**
	 * @param description
	 *            The description to set.
	 */
	public void setDescription(String description) {
		fDescription = description;
	}

	public void setNameFromAttribute(String nameFromAttribute) {
		this.nameFromAttribute = nameFromAttribute;
	}

	public void setNameGiven(String nameGiven) {
		this.nameGiven = nameGiven;
	}

	public void setScope(String scope) {
		this.scope = scope;
	}

	public void setVariableClass(String variableClass) {
		this.variableClass = variableClass;
	}

	public String toString() {
		StringBuffer buffer = new StringBuffer();
		buffer.append(super.toString());
		buffer.append("\n\t name given:" + StringUtils.escape(getNameGiven())); //$NON-NLS-1$
		buffer.append("\n\t name from attribute:" + StringUtils.escape(getNameFromAttribute())); //$NON-NLS-1$
		// Boolean.toString(boolean) is introduced in JDK 1.4
		// buffer.append("\n\t declare:" +
		// StringUtils.escape(Boolean.toString(getDeclare())));
		buffer.append("\n\t declare:" + StringUtils.toString(getDeclare())); //$NON-NLS-1$
		buffer.append("\n\t scope:" + StringUtils.escape(getScope())); //$NON-NLS-1$
		buffer.append("\n\t variable class:" + StringUtils.escape(getVariableClass())); //$NON-NLS-1$
		return buffer.toString();
	}

	public String getAlias() {
		return fAlias;
	}

	public void setAlias(String alias) {
		fAlias = alias;
	}
}

Back to the top