public class ServicesUtil extends Object
| Constructor and Description |
|---|
ServicesUtil() |
| Modifier and Type | Method and Description |
|---|---|
static void |
validateIfAnyResult(Collection resultToCheck,
String unknownIdException)
Checks if collection contains any objects.
|
static void |
validateIfSingleResult(Collection<? extends Object> resultToCheck,
Class clazz,
String qualifier,
Object qualifierValue)
Checks if collection contains only a single object and generates proper exception messages out of passed type and
qualifier.
|
static void |
validateIfSingleResult(Collection<? extends Object> resultToCheck,
String unknownIdException,
String ambiguousIdException)
Checks if collection contains only a single object.
|
static void |
validateParameterNotNull(Object parameter,
String nullMessage)
Validates if parameter passed to method is not null
|
static void |
validateParameterNotNullStandardMessage(String parameter,
Object parameterValue)
Validates if parameter value passed to method is not null.
|
public static void validateIfSingleResult(Collection<? extends Object> resultToCheck, String unknownIdException, String ambiguousIdException)
resultToCheck - collection to checkunknownIdException - message for exception thrown if collection is empty or is nullambiguousIdException - message for exception thrown if collection has more than one objectUnknownIdentifierException - if collection is empty or is nullAmbiguousIdentifierException - if collection has more than one objectpublic static void validateIfSingleResult(Collection<? extends Object> resultToCheck, Class clazz, String qualifier, Object qualifierValue)
resultToCheck - collection to checkclazz - result must contain elements which are assignable from this clazzqualifier - unique qualifier used for searchqualifierValue - for qualifierUnknownIdentifierException - if collection is empty or is nullAmbiguousIdentifierException - if collection has more than one objectIllegalStateException - if element in collection is NOT of the given typepublic static void validateIfAnyResult(Collection resultToCheck, String unknownIdException)
resultToCheck - collection to checkunknownIdException - message for exception thrown if collection is empty or is nullUnknownIdentifierException - if collection is empty or is nullpublic static void validateParameterNotNull(Object parameter, String nullMessage)
parameter - to checknullMessage - message for exception thrown if parameter is nullIllegalArgumentException - if parameter is nullpublic static void validateParameterNotNullStandardMessage(String parameter, Object parameterValue)
parameter - name of parameter used for exception messageparameterValue - value to check for nullIllegalArgumentException - if parameter is nullCopyright © 2017 SAP SE. All Rights Reserved.