Parses the provided string value into a long value.
<p>If the string is null or empty this returns the default value.</p>

@param value        value to parse
@param defaultValue default value
@return long representation of provided value or default value.
344570
public static Long parseLong(String value, Long defaultValue) {
        if (isNullOrEmpty(value)) {
            return defaultValue;
        }
        return Long.parseLong(value);
    }
1032177
public long readLong(long defaultValue, String attribute)
    {
        return Long.parseLong(getValue(String.valueOf(defaultValue), attribute));
    }
252219
@Override
    public final long optLong(final String key, final long defaultValue) {
        Long result = optLong(key);
        return result == null ? defaultValue : result;
    }
766264
public static String getStringValue(Object newValue, String defaultValue) {
        if (newValue == null)
            return defaultValue;

        return (String) newValue;
    }
1333980
static long parseLong(String key, @Nullable String value) {
    requireArgument((value != null) && !value.isEmpty(), "value of key %s was omitted", key);
    try {
      return Long.parseLong(value);
    } catch (NumberFormatException e) {
      throw new IllegalArgumentException(String.format(
          "key %s value was set to %s, must be a long", key, value), e);
    }
  }
905336
public Long getParameterTime(String name, Long defaultValue)
   {
      String value = getParameterValue(name, null);

      if (value != null)
      {
         try
         {
            return StringNumberParser.parseTime(value);
         }
         catch (NumberFormatException e)
         {
            if (LOG.isTraceEnabled())
            {
               LOG.trace("An exception occurred: " + e.getMessage());
            }
         }
      }
      return defaultValue;
   }
479850
public static long getLong(
    Object      value)
  {
    if (value == null)
    {
        return 0;
    }

    return Long.valueOf(value.toString()).longValue();
  }
1287780
public T orElse(T defaultValue) {
        T value = get();

        if (value != null) {
            return value;
        }

        return defaultValue;
    }
864478
@Override
	public void setValue(StringValue value) {
		Validate.notNull(value);
		setValue(value.value, 0, value.len);
	}
873698
public static Long toLongObject(@Nullable String str, Long defaultValue) {
		if (StringUtils.isEmpty(str)) {
			return defaultValue;
		}
		try {
			return Long.valueOf(str);
		} catch (final NumberFormatException nfe) {
			return defaultValue;
		}
	}
481065
public static Object toNull(Object value, Object defaultValue) {
	if (value == null) return null;
	if (value instanceof String && Caster.toString(value, "").trim().length() == 0) return null;
	if (value instanceof Number && ((Number) value).intValue() == 0) return null;
	return defaultValue;
    }
1014878
public String get(String key, String defaultValue) {
		addToDefaults(key, defaultValue);
		String value = get(key);
		if (value == null) {
			return defaultValue;
		} else {
			return value;
		}
	}
190667
public static Long toLong(Object value, Long defaultValue) {
		return convert(Long.class, value, defaultValue);
	}
390087
public static long parseDate(String value) {
        Date date = null;
        for (SimpleDateFormat format : FORMATS_TEMPLATE) {
            try {
                date = format.parse(value);
            } catch (ParseException e) {
                // Nothing.
            }
        }

        if (date == null) return -1L;
        return date.getTime();
    }
744771
public long getLong(String name, long defaultVal){
        if(this.configuration.containsKey(name)){
            return this.configuration.getLong(name);
        } else {
            return defaultVal;
        }
    }
721019
public String set(String value)
    {
        String prevValue = setString(value);
        if (prevValue == null) {
            prevValue = getDefaultValue();
        }
        return prevValue;
    }
316818
public static Boolean parseGeneralString(String str, Boolean defaultValue) {
		return BooleanUtils.toBooleanDefaultIfNull(BooleanUtils.toBooleanObject(str), defaultValue);
	}