|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.atlassian.confluence.macro.params.BaseParameter<T>
public abstract class BaseParameter<T>
A base implementation of Parameter, providing support
for multiple default parameter names, and a default value if
no parameter is specified.
| Field Summary | |
|---|---|
protected boolean |
shouldValidate
|
| Constructor Summary | |
|---|---|
protected |
BaseParameter(List<String> names,
String defaultValue)
|
protected |
BaseParameter(String[] names,
String defaultValue)
|
protected |
BaseParameter(String name,
String defaultValue)
|
| Method Summary | |
|---|---|
void |
addParameterAlias(String name)
Deprecated. since 3.1: this class is not thread safe and should not be mutated |
protected abstract T |
findObject(String paramValue,
MacroExecutionContext ctx)
Responsible for converting a macro parameter string value to its proper object representation (say "1" to new Integer(1)) |
T |
findValue(MacroExecutionContext ctx)
Attempts to find the value from the specified MacroExecutionContext object. |
String |
getDefaultValue()
Returns the default value for this parameter if no match is found in the context. |
protected String |
getParameter(Map<String,String> params,
List names,
String defaultValue)
Returns the literal value of the parameter in the specified Map, using the specified List for names and
aliases and the specified default value. |
String |
getParameterValue(Map<String,String> params)
Returns the literal value of the parameter, or the default value if none is present. |
void |
setDefaultValue(String defaultValue)
Deprecated. since 3.1: this class is not thread safe and should not be mutated |
void |
setParameterNames(String[] names)
Deprecated. since 3.1: this class is not thread safe and should not be mutated |
void |
setValidate(boolean shouldValidate)
Sets whether this parameter should attempt to validate its values. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected boolean shouldValidate
| Constructor Detail |
|---|
protected BaseParameter(String name,
String defaultValue)
protected BaseParameter(String[] names,
String defaultValue)
protected BaseParameter(List<String> names,
String defaultValue)
| Method Detail |
|---|
@Deprecated public final void addParameterAlias(String name)
name - another name for the parameter recognized by this object@Deprecated public final void setParameterNames(String[] names)
names - the names of the parameter to recognize@Deprecated public final void setDefaultValue(String defaultValue)
defaultValue - the default value for this parameterpublic final String getDefaultValue()
protected final String getParameter(Map<String,String> params,
List names,
String defaultValue)
Map, using the specified List for names and
aliases and the specified default value.
params - the Map of parameters to searchnames - the parameter names to look fordefaultValue - the default value to return if no match is found
public final String getParameterValue(Map<String,String> params)
params - the Map of parameters to search
public final void setValidate(boolean shouldValidate)
Parameter
setValidate in interface Parameter<T>shouldValidate - true if this parameter should attempt to validate
public final T findValue(MacroExecutionContext ctx)
throws ParameterException
ParameterMacroExecutionContext object.
findValue in interface Parameter<T>ctx - The execution context for the macro.
ParameterException - if there was a problem while processing the parameter.
protected abstract T findObject(String paramValue,
MacroExecutionContext ctx)
throws ParameterException
ParameterException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||