ShrinkWrap Resolver Maven Implementation 2.0.0-alpha-4

org.jboss.shrinkwrap.resolver.impl.maven.util
Class Validate

java.lang.Object
  extended by org.jboss.shrinkwrap.resolver.impl.maven.util.Validate

public final class Validate
extends Object

Validate Validation utility

Author:
Aslak Knutsen

Method Summary
static boolean isNullOrEmpty(String string)
          Checks that the specified String is not null or empty.
static void isReadable(File path, String message)
          Checks that the specified String is not null or empty and represents a readable file, throws exception if it is empty or null and does not represent a path to a file.
static void isReadable(String path, String message)
          Checks that the specified String is not null or empty and represents a readable file, throws exception if it is empty or null and does not represent a path to a file.
static void isWriteableDirectory(String path, String message)
          Checks that the specified String is not null or empty and represents a writeable directory, throws exception if it is empty or null and does not represent a path to a directory.
static void notEmpty(Collection<?> collection, String message)
          Checks that collection is not null or empty, throws exception if it is.
static void notNull(Object obj, String message)
          Checks that object is not null, throws exception if it is.
static void notNullAndNoNullValues(Object[] objects, String message)
          Checks that the specified array is not null or contain any null values.
static void notNullOrEmpty(String string, String message)
          Checks that the specified String is not null or empty, throws exception if it is.
static void stateNotNull(Object obj, String message)
          Checks that object is not null, throws exception if it is.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

notNull

public static void notNull(Object obj,
                           String message)
                    throws IllegalArgumentException
Checks that object is not null, throws exception if it is.

Parameters:
obj - The object to check
message - The exception message
Throws:
IllegalArgumentException - Thrown if obj is null

stateNotNull

public static void stateNotNull(Object obj,
                                String message)
                         throws IllegalStateException
Checks that object is not null, throws exception if it is.

Parameters:
obj - The object to check
message - The exception message
Throws:
IllegalStateException - Thrown if obj is null

notEmpty

public static void notEmpty(Collection<?> collection,
                            String message)
                     throws IllegalArgumentException
Checks that collection is not null or empty, throws exception if it is.

Parameters:
collection - The collection to be checked
message - The exception message
Throws:
IllegalArgumentException - Thrown if collection is null or empty

isNullOrEmpty

public static boolean isNullOrEmpty(String string)
Checks that the specified String is not null or empty.

Parameters:
string - The object to check
message - The exception message
Returns:
true if specified String is null or empty, false otherwise

notNullOrEmpty

public static void notNullOrEmpty(String string,
                                  String message)
                           throws IllegalArgumentException
Checks that the specified String is not null or empty, throws exception if it is.

Parameters:
string - The object to check
message - The exception message
Throws:
IllegalArgumentException - Thrown if string is null

isReadable

public static void isReadable(String path,
                              String message)
                       throws IllegalArgumentException
Checks that the specified String is not null or empty and represents a readable file, throws exception if it is empty or null and does not represent a path to a file.

Parameters:
path - The path to check
message - The exception message
Throws:
IllegalArgumentException - Thrown if path is empty, null or invalid

isReadable

public static void isReadable(File path,
                              String message)
                       throws IllegalArgumentException
Checks that the specified String is not null or empty and represents a readable file, throws exception if it is empty or null and does not represent a path to a file.

Parameters:
path - The path to check
message - The exception message
Throws:
IllegalArgumentException - Thrown if path is empty, null or invalid

isWriteableDirectory

public static void isWriteableDirectory(String path,
                                        String message)
                                 throws IllegalArgumentException
Checks that the specified String is not null or empty and represents a writeable directory, throws exception if it is empty or null and does not represent a path to a directory.

Parameters:
path - The path to check
message - The exception message
Throws:
IllegalArgumentException - Thrown if path is empty, null or invalid

notNullAndNoNullValues

public static void notNullAndNoNullValues(Object[] objects,
                                          String message)
Checks that the specified array is not null or contain any null values.

Parameters:
objects - The object to check
message - The exception message

ShrinkWrap Resolver Maven Implementation 2.0.0-alpha-4

Copyright © 2012 JBoss by Red Hat. All Rights Reserved.