Drools Workbench - Data Model API 6.1.0.CR2

org.drools.workbench.models.datamodel.util
Class PortablePreconditions

java.lang.Object
  extended by org.drools.workbench.models.datamodel.util.PortablePreconditions

public class PortablePreconditions
extends Object

Helper class for parameters validation, such as not null arguments.


Constructor Summary
protected PortablePreconditions()
          Should not be instantiated
 
Method Summary
static void checkCondition(String name, boolean condition)
          Assert that this parameter is marked as valid by the condition passed as parameter.
static
<T> void
checkEachParameterNotNull(String name, T... parameters)
          Assert that this parameter is not null, as also each item of the array is not null.
static void checkNotEmpty(String name, Map<?,?> parameter)
          Assert that this parameter is not empty.
static String checkNotEmpty(String name, String parameter)
          Assert that this parameter is not empty.
static
<T extends Collection<?>>
T
checkNotEmpty(String name, T parameter)
          Assert that this parameter is not empty.
static
<T> T[]
checkNotEmpty(String name, T[] parameter)
          Assert that this parameter is not empty.
static
<T> T
checkNotNull(String name, T parameter)
          Assert that this parameter is not null.
static void checkNullMandatory(String name, Object parameter)
          Assert that this parameter is null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PortablePreconditions

protected PortablePreconditions()
Should not be instantiated

Method Detail

checkCondition

public static void checkCondition(String name,
                                  boolean condition)
Assert that this parameter is marked as valid by the condition passed as parameter.

Parameters:
name - of parameter
condition - itself

checkEachParameterNotNull

public static <T> void checkEachParameterNotNull(String name,
                                                 T... parameters)
Assert that this parameter is not null, as also each item of the array is not null.

Type Parameters:
T - parameter type
Parameters:
name - of parameter
parameters - itself

checkNotEmpty

public static <T extends Collection<?>> T checkNotEmpty(String name,
                                                        T parameter)
Assert that this parameter is not empty. It will test for null and also the size of this array.

Parameters:
name - of parameter
parameter - itself

checkNotEmpty

public static void checkNotEmpty(String name,
                                 Map<?,?> parameter)
Assert that this parameter is not empty. It will test for null and also the size of this array.

Parameters:
name - of parameter
parameter - itself

checkNotEmpty

public static String checkNotEmpty(String name,
                                   String parameter)
Assert that this parameter is not empty. It trims the parameter to see if have any valid data on that.

Parameters:
name - of parameter
parameter - itself

checkNotEmpty

public static <T> T[] checkNotEmpty(String name,
                                    T[] parameter)
Assert that this parameter is not empty. It will test for null and also the size of this array.

Type Parameters:
T - type of the array
Parameters:
name - of parameter
parameter - itself

checkNotNull

public static <T> T checkNotNull(String name,
                                 T parameter)
Assert that this parameter is not null.

Parameters:
name - of parameter
parameter - itself

checkNullMandatory

public static void checkNullMandatory(String name,
                                      Object parameter)
Assert that this parameter is null.

Parameters:
name - of parameter
parameter - itself

Drools Workbench - Data Model API 6.1.0.CR2

Copyright © 2001-2014 JBoss by Red Hat. All Rights Reserved.