Skip to main content
summaryrefslogtreecommitdiffstats
blob: dd1f650d0e4f952acb017f17bc911c5470a823b7 (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
package org.eclipse.cdt.internal.corext.template;

/*
 * (c) Copyright IBM Corp. 2000, 2001.
 * All Rights Reserved.
 */

/**
 * A template variable.
 */
public abstract class TemplateVariable {

	/** name of the variable */
	private final String fName;

	/** description of the variable */
	private final String fDescription;
	
	/**
	 * Creates an instance of <code>TemplateVariable</code>.
	 * 
	 * @param name the name of the variable
	 * @param description the description for the variable
	 */
	protected TemplateVariable(String name, String description) {
	 	fName= name;
	 	fDescription= description;   
	}
	
	/**
	 * Returns the name of the variable.
	 */
	public String getName() {
		return fName;
	}

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

	/**
	 * Tests if this variable can be evaluated.
	 */
//	public abstract boolean canEvaluate(TemplateContext context);
	
	/**
	 * Evaluates this variable
	 * 
	 * @return the evaluated string, or <code>null</code> if not evaluatable.
	 */
	public abstract String evaluate(TemplateContext context);

	/**
	 * Returns whether this variable is resolved.
	 * By default, the variable is not resolved.
	 * Clients can overwrite this method to force resolution of the variable.
	 */
	public boolean isResolved(TemplateContext context) {
		return false;
	}

}

Back to the top