Verifies a value is null or empty. Returns the value if non-empty and throws exception if empty.
@param value the value to verify.
@param argName the name of the value.
@return Returns the value if non-empty.
184218
protected static String verifyNonEmpty(String value, String argName) {
        if (value != null) {
            value = value.trim();
            if (value.isEmpty()) {
                value = null;
            }
        }
        if (value == null) {
            throw new IllegalArgumentException(argName);
        }
        return value;
    }
829362
public static Integer checkNull(Integer value, int elseValue) {
        return checkNull(value, Integer.valueOf(elseValue));
    }
1067621
public static String checkNull(String value, String elseValue) {
        return isNull(value) ? elseValue : value;
    }
929579
public static function notNull($argValue, $argName = '')
    {
        $valid = ($argValue !== null);
        if (!$valid) {
            $message = implode(' ', array_filter(['Argument', $argName, 'must not be null']));
            throw new \InvalidArgumentException($message);
        }
        return $valid;
    }
62443
@Nonnull
    public static <T> T checkNotNull(T value, @Nonnull String errorMessage) {
        if (value == null) {
            throw new NullPointerException(errorMessage);
        }
        return value;
    }
885847
public static boolean isValueReference(String value)
    {
        if (value == null)
        {
            throw new NullPointerException("value");
        }

        int start = value.indexOf("#{");
        if (start < 0)
        {
            return false;
        }

        int end = value.lastIndexOf('}');
        return (end >= 0 && start < end);
    }
574216
protected boolean isEmpty(Object value) {
        if (value == null)
            return true;
        if ( value.equals("") )
            return true;
        return false;
    }
147463
public static boolean set(String value) {
        if (StringUtil.isEmpty(value)) {
            throw new IllegalArgumentException("Can not set an empty msgId. If you want to clear msgId of current context, use clear() instead.");
        }
        if (Objects.equals(value, MsgIdHolder.get())) {
            //no need make sure, return false
            return false;
        } else {
            //overwrite the old value
            singleton.set0(value);
            return true;
        }
    }
619505
public static void checkIfPowerOf2(final int v, final String argName) {
    if ((v > 0) && ((v & (v - 1)) == 0)) {
      return;
    }
    throw new SketchesArgumentException("The value of the parameter \"" + argName
        + "\" must be a positive integer-power of 2" + " and greater than 0: " + v);
  }
252253
public function validateArgument($argname, $value, $type, $nullable = false)
    {
        if (!$this->checkType($value, $type, $nullable)) {
            throw new OperationArgumentException(sprintf(
                'Method %s() expects $%s to be %s, %s given.',
                $this->operation,
                $argname,
                $type,
                gettype($value)
            ));
        }
    }
653910
public function validateArrayArgument($argname, array $value, $type, $nullable = false)
    {
        foreach ($value as $element) {
            if (!$this->checkType($element, $type, $nullable)) {
                throw new OperationArgumentException(sprintf(
                    'Method %s() expects all of $%s elements to be %s, found %s.',
                    $this->operation,
                    $argname,
                    $type,
                    gettype($element)
                ));
            }
        }
    }
408903
@Override
    public ValidationResult validate(Object value) {
        if (value == null || value instanceof String) {
            return new ValidationResult.ValidationPassed();
        } else {
            return new ValidationResult.ValidationFailed("Value \"" + value + "\" is not a valid string!");
        }
    }
52130
public static FormValidation validateRequired(String value) {
        if (Util.fixEmptyAndTrim(value) == null)
            return error(Messages.FormValidation_ValidateRequired());
        return ok();
    }
556965
public static Boolean isNotSet(String value) {
        return null == value || value.isEmpty() || value.trim().length() == 0;
    }
229399
public static void isNull (final Object aValue, @Nonnull final Supplier <? extends String> aName)
  {
    if (isEnabled ())
      if (aValue != null)
        throw new IllegalArgumentException ("The value of '" + aName.get () + "' must be null but is " + aValue);
  }
585319
def _is_null(self, value):
        """"""
        if isinstance(value, six.string_types):
            if not len(value.strip()):
                return True
        return value is None
868600
public static <T> T validateEmpty(T value, String errorMsg) throws ValidateException {
		if (isNotEmpty(value)) {
			throw new ValidateException(errorMsg);
		}
		return value;
	}