net.sf.sasl.language.placeholder.aop.resolver
Class ResolveExceptionHelper

java.lang.Object
  extended by net.sf.sasl.language.placeholder.aop.resolver.ResolveExceptionHelper

public class ResolveExceptionHelper
extends Object

Since:
0.0.1 (sasl-common-aspect-library)
Author:
Philipp Förmer

Constructor Summary
ResolveExceptionHelper()
           
 
Method Summary
static void validateArgumentCount(String placeholderName, Object[] arguments, int min, int max)
          Throws a resolve exception if the argument count is lesser than min or greater than max.
static void validateArgumentTypes(String placeholderName, Object[] arguments, Class<?>... types)
          Throws a ResolveException if the arguments in the arguments array are not assignable to the classes defined by types.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResolveExceptionHelper

public ResolveExceptionHelper()
Method Detail

validateArgumentCount

public static void validateArgumentCount(String placeholderName,
                                         Object[] arguments,
                                         int min,
                                         int max)
                                  throws ResolveException,
                                         IllegalArgumentException
Throws a resolve exception if the argument count is lesser than min or greater than max.

Parameters:
placeholderName - non null
arguments - non null
min - positive integer
max - positive integer
Throws:
ResolveException
IllegalArgumentException - if arguments is null.

validateArgumentTypes

public static void validateArgumentTypes(String placeholderName,
                                         Object[] arguments,
                                         Class<?>... types)
                                  throws ResolveException,
                                         IllegalArgumentException
Throws a ResolveException if the arguments in the arguments array are not assignable to the classes defined by types. The procedure will not validate if the argument count is correct. The check will be only done up to index < Math.min(arguments.length, types.length). So it will check if arguments[i] is assignable to types[i].

Parameters:
placeholderName - non null
arguments - non null
types - non null
Throws:
ResolveException
IllegalArgumentException - if arguments or types is null


Copyright © 2010. All Rights Reserved.