Java Object NVL isNullOrEmpty(final Object obj)

Here you can find the source of isNullOrEmpty(final Object obj)

Description

is Null Or Empty

License

Open Source License

Declaration

@SuppressWarnings("unchecked")
    public static boolean isNullOrEmpty(final Object obj) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.*;

public class Main {
    @SuppressWarnings("unchecked")
    public static boolean isNullOrEmpty(final Object obj) {
        if (obj == null) {
            return true;
        }//from  ww w. j  a va 2 s . c om
        if (obj.getClass().equals(Collection.class)) {
            return ((Collection) obj).size() == 0;
        } else {
            if (obj.toString().trim().length() == 0) {
                return true;
            }
        }

        return false;
    }
}

Related

  1. isEmpty(Object obj)
  2. isEmpty(Object value)
  3. isEmpty(Object... obj)
  4. isNotEmpty(Object object)
  5. isNullOrEmpty(Object object, boolean zeroEqualsEmpty)
  6. isNullOrEmptyOrZero(Object object)
  7. nvl(Boolean b, boolean defaultValue)
  8. nvl(CharSequence source)