com.atlassian.jira.webwork.parameters
Interface ParameterConverter

All Known Implementing Classes:
BooleanArrayConverter, BooleanConverter, ByteArrayConverter, ByteConverter, CharacterArrayConverter, CharacterConverter, DoubleArrayConverter, DoubleConverter, FloatArrayConverter, FloatConverter, IntegerArrayConverter, IntegerConverter, LongArrayConverter, LongConverter, ShortArrayConverter, ShortConverter

@Immutable
public interface ParameterConverter

This is called to convert a value from String[] format into the specific type. If it cant convert the value it should throw an IllegalArgumentException.

When dealing with Numbers and their primitive types, its imperative to differentiate between conversions on empty strings. Empty string be converted to a null 'Long' but not to a 'long'.

Introduced / changed as part of JRA-15664

Since:
v3.13.2

Method Summary
 Object convertParameter(String[] parameterValues, Class paramType)
          This is called to perform the conversion.
 

Method Detail

convertParameter

Object convertParameter(String[] parameterValues,
                        Class paramType)
                        throws IllegalArgumentException
This is called to perform the conversion. The parameterValues will always be a String[] of length 1 or more. It can never be null.

Parameters:
parameterValues - a String[] that is never null and at least length 1 or more.
paramType - the type of the target object
Returns:
a converted object of the right type
Throws:
IllegalArgumentException - if the value cant be converted


Copyright © 2002-2014 Atlassian. All Rights Reserved.