org.kuali.common.util.nullify
Class NullUtils

java.lang.Object
  extended by org.kuali.common.util.nullify.NullUtils

public class NullUtils
extends Object


Field Summary
static String NONE
           
static String NULL
           
 
Constructor Summary
NullUtils()
           
 
Method Summary
static boolean isBlank(Object object)
          Return true if object is a non null CharSequence that is pure whitespace
static boolean isNone(String s)
          Return true if:
static boolean isNull(String s)
          Return true if:
static boolean isNullOrBlank(Object object)
          Return true if object is null OR a non null CharSequence that is pure whitespace
static boolean isNullOrNone(String s)
          Return true iff:
static com.google.common.base.Optional<String> toAbsent(String s)
          Returns Optional.absent() if s is null, the empty string, pure whitespace, NONE, or NULL
static String toNone(com.google.common.base.Optional<String> optional)
          Returns NONE if optional is not present OR if it contains the empty string, pure whitespace, NONE, or NULL
static String trimToNone(String s)
          Returns NONE if s is null, the empty string, pure whitespace, NONE, or NULL
static String trimToNull(String s)
          Returns null if s is null, the empty string, pure whitespace, NONE, or NULL
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NONE

public static final String NONE
See Also:
Constant Field Values

NULL

public static final String NULL
See Also:
Constant Field Values
Constructor Detail

NullUtils

public NullUtils()
Method Detail

isBlank

public static boolean isBlank(Object object)
Return true if object is a non null CharSequence that is pure whitespace


isNullOrBlank

public static boolean isNullOrBlank(Object object)
Return true if object is null OR a non null CharSequence that is pure whitespace


isNull

public static final boolean isNull(String s)
Return true if:
  s == null
  StringUtils.equalsIgnoreCase("null", s) == true
 


isNone

public static final boolean isNone(String s)
Return true if:
 StringUtils.equalsIgnoreCase("none", s) == true
 


isNullOrNone

public static final boolean isNullOrNone(String s)
Return true iff:
  s == null
  StringUtils.equalsIgnoreCase("null", s) == true
  StringUtils.equalsIgnoreCase("none", s) == true
 


toAbsent

public static final com.google.common.base.Optional<String> toAbsent(String s)
Returns Optional.absent() if s is null, the empty string, pure whitespace, NONE, or NULL


toNone

public static final String toNone(com.google.common.base.Optional<String> optional)
Returns NONE if optional is not present OR if it contains the empty string, pure whitespace, NONE, or NULL


trimToNull

public static final String trimToNull(String s)
Returns null if s is null, the empty string, pure whitespace, NONE, or NULL


trimToNone

public static final String trimToNone(String s)
Returns NONE if s is null, the empty string, pure whitespace, NONE, or NULL



Copyright © 2010–2014 The Kuali Foundation. All rights reserved.