|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.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(java.util.List<java.lang.String> names,
java.lang.String defaultValue)
|
protected |
BaseParameter(java.lang.String[] names,
java.lang.String defaultValue)
|
protected |
BaseParameter(java.lang.String name,
java.lang.String defaultValue)
|
Method Summary | |
---|---|
void |
addParameterAlias(java.lang.String name)
Deprecated. since 3.1: this class is not thread safe and should not be mutated |
protected abstract T |
findObject(java.lang.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. |
java.lang.String |
getDefaultValue()
Returns the default value for this parameter if no match is found in the context. |
protected java.lang.String |
getParameter(java.util.Map<java.lang.String,java.lang.String> params,
java.util.List names,
java.lang.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. |
java.lang.String |
getParameterValue(java.util.Map<java.lang.String,java.lang.String> params)
Returns the literal value of the parameter, or the default value if none is present. |
void |
setDefaultValue(java.lang.String defaultValue)
Deprecated. since 3.1: this class is not thread safe and should not be mutated |
void |
setParameterNames(java.lang.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(java.lang.String name, java.lang.String defaultValue)
protected BaseParameter(java.lang.String[] names, java.lang.String defaultValue)
protected BaseParameter(java.util.List<java.lang.String> names, java.lang.String defaultValue)
Method Detail |
---|
public final void addParameterAlias(java.lang.String name)
name
- another name for the parameter recognized by this objectpublic final void setParameterNames(java.lang.String[] names)
names
- the names of the parameter to recognizepublic final void setDefaultValue(java.lang.String defaultValue)
defaultValue
- the default value for this parameterpublic final java.lang.String getDefaultValue()
protected final java.lang.String getParameter(java.util.Map<java.lang.String,java.lang.String> params, java.util.List names, java.lang.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 java.lang.String getParameterValue(java.util.Map<java.lang.String,java.lang.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 validatepublic final T findValue(MacroExecutionContext ctx) throws ParameterException
Parameter
MacroExecutionContext
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(java.lang.String paramValue, MacroExecutionContext ctx) throws ParameterException
ParameterException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |