org.specrunner.converters
Class UtilConverter

java.lang.Object
  extended by org.specrunner.converters.UtilConverter

public final class UtilConverter
extends Object

Converter utilities.

Author:
Thiago Santos

Field Summary
static Map<Class<?>,Class<?>> PRIMITIVES
          Map of primitive types for correct use of <type>.isInstance(...)
 
Method Summary
static Converter getConverter(Annotation[] annots)
          Extract converter information from parameter annotations.
static Class<?> getWrapper(Class<?> clazz)
          Get errors.
static Object prepareArgument(String message, Annotation[] annotations, Class<?> type, Object arg)
          Prepare only one argument.
static void prepareMethodArguments(Method method, List<Object> arguments)
          Prepare arguments.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PRIMITIVES

public static final Map<Class<?>,Class<?>> PRIMITIVES
Map of primitive types for correct use of <type>.isInstance(...).

Method Detail

getWrapper

public static Class<?> getWrapper(Class<?> clazz)
Get errors.

Parameters:
clazz - O errors.
Returns:
The class.

prepareMethodArguments

public static void prepareMethodArguments(Method method,
                                          List<Object> arguments)
                                   throws PluginException
Prepare arguments.

Parameters:
method - The method.
arguments - The arguments.
Throws:
PluginException - On preparation errors.

prepareArgument

public static Object prepareArgument(String message,
                                     Annotation[] annotations,
                                     Class<?> type,
                                     Object arg)
                              throws PluginException
Prepare only one argument.

Parameters:
message - The message.
annotations - A list of annotations.
type - The object expected type..
arg - The current argument.
Returns:
The result of argument preparation.
Throws:
PluginException - On preparation errors.

getConverter

public static Converter getConverter(Annotation[] annots)
Extract converter information from parameter annotations.

Parameters:
annots - The annotations.
Returns:
The converter annotation if exists, null, otherwise.


Copyright © 2014. All rights reserved.