com.atlassian.renderer.v2.macro.basic.validator
Class ValidatedMacroParameters

java.lang.Object
  extended by com.atlassian.renderer.v2.macro.basic.validator.ValidatedMacroParameters

public class ValidatedMacroParameters
extends Object

Wraps a parameter map of String -> String mappings, providing validation by means of a mapping of parameters to ParameterValidators.


Constructor Summary
ValidatedMacroParameters(Map parameters)
           
 
Method Summary
 String getValue(String parameterName)
          Returns the value of the parameter from the underlying parameter map, or throws an exception if the value does not pass the validation for that parameter configured by setValidator(String,ParameterValidator).
 void setValidator(String parameterName, ParameterValidator parameterValidator)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ValidatedMacroParameters

public ValidatedMacroParameters(Map parameters)
Method Detail

setValidator

public void setValidator(String parameterName,
                         ParameterValidator parameterValidator)

getValue

public String getValue(String parameterName)
                throws MacroParameterValidationException
Returns the value of the parameter from the underlying parameter map, or throws an exception if the value does not pass the validation for that parameter configured by setValidator(String,ParameterValidator). A parameter which does not have a validator configured will return the value without validating it.

Parameters:
parameterName - the name of the parameter to retrieve
Returns:
the parameter value, if it is valid or there is no validator for the parameter, or null if the parameter is not specified.
Throws:
MacroParameterValidationException - if the parameter is not valid


Copyright © 2009 Atlassian Pty Ltd. All Rights Reserved.