Replace default values will null, allowing them to be ignored.

@param value value to test
@return filtered value
336249
private Object filterValue(Object value)
   {
      if (value instanceof Boolean && !((Boolean) value).booleanValue())
      {
         value = null;
      }
      if (value instanceof String && ((String) value).isEmpty())
      {
         value = null;
      }
      if (value instanceof Double && ((Double) value).doubleValue() == 0.0)
      {
         value = null;
      }
      if (value instanceof Integer && ((Integer) value).intValue() == 0)
      {
         value = null;
      }
      if (value instanceof Duration && ((Duration) value).getDuration() == 0.0)
      {
         value = null;
      }

      return value;
   }
1239062
public static String replaceNonPrintableControlCharacters(final String value) {
        if (value == null || value.length() == 0) {
            return value;
        }

        boolean changing = false;
        for (int i = 0, length = value.length(); i < length; i++) {
            final char ch = value.charAt(i);
            if (ch < 32 && ch != '\n' && ch != '\r' && ch != '\t') {
                changing = true;
                break;
            }
        }

        if (!changing) {
            return value;
        }

        final StringBuilder buf = new StringBuilder(value);
        for (int i = 0, length = buf.length(); i < length; i++) {
            final char ch = buf.charAt(i);
            if (ch < 32 && ch != '\n' && ch != '\r' && ch != '\t') {
                buf.setCharAt(i, ' ');
            }
        }

        // return cleaned string
        return buf.toString();
    }
120296
private static String replaceProperties(final String value) {
        final StringBuilder builder = new StringBuilder();
        final int len = value.length();
        int state = 0;
        int start = -1;
        int nameStart = -1;
        for (int i = 0; i < len; i = value.offsetByCodePoints(i, 1)) {
            final char ch = value.charAt(i);
            switch (state) {
                case INITIAL: {
                    switch (ch) {
                        case '$': {
                            state = GOT_DOLLAR;
                            continue;
                        }
                        default: {
                            builder.append(ch);
                            continue;
                        }
                    }
                    // not reachable
                }
                case GOT_DOLLAR: {
                    switch (ch) {
                        case '$': {
                            builder.append(ch);
                            state = INITIAL;
                            continue;
                        }
                        case '{': {
                            start = i + 1;
                            nameStart = start;
                            state = GOT_OPEN_BRACE;
                            continue;
                        }
                        default: {
                            // invalid; emit and resume
                            builder.append('$').append(ch);
                            state = INITIAL;
                            continue;
                        }
                    }
                    // not reachable
                }
                case GOT_OPEN_BRACE: {
                    switch (ch) {
                        case ':':
                        case '}':
                        case ',': {
                            final String name = value.substring(nameStart, i).trim();
                            if ("/".equals(name)) {
                                builder.append('/');
                                state = ch == '}' ? INITIAL : RESOLVED;
                                continue;
                            } else if (":".equals(name)) {
                                builder.append('/');
                                state = ch == '}' ? INITIAL : RESOLVED;
                                continue;
                            }
                            final String val = null;//System.getProperty(name);
                            if (val != null) {
                                builder.append(val);
                                state = ch == '}' ? INITIAL : RESOLVED;
                                continue;
                            } else if (ch == ',') {
                                nameStart = i + 1;
                                continue;
                            } else if (ch == ':') {
                                start = i + 1;
                                state = DEFAULT;
                                continue;
                            } else {
                                builder.append(value.substring(start - 2, i + 1));
                                state = INITIAL;
                                continue;
                            }
                        }
                        default: {
                            continue;
                        }
                    }
                    // not reachable
                }
                case RESOLVED: {
                    if (ch == '}') {
                        state = INITIAL;
                    }
                    continue;
                }
                case DEFAULT: {
                    if (ch == '}') {
                        state = INITIAL;
                        builder.append(value.substring(start, i));
                    }
                    continue;
                }
                default: throw new IllegalStateException();
            }
        }
        switch (state) {
            case GOT_DOLLAR: {
                builder.append('$');
                break;
            }
            case DEFAULT:
            case GOT_OPEN_BRACE: {
                builder.append(value.substring(start - 2));
                break;
            }
        }
        return builder.toString();
    }
1008165
public static String toStringWithDefault(Object value, String defaultValue) {
		String result = toNullableString(value);
		return result != null ? result : defaultValue;
	}
654386
public static <T> OptionalValue<T> ofNullable(T value) {
        return new GenericOptionalValue<T>(RUNTIME_SOURCE, DEFAULT_KEY, value);
    }
370457
public static <T> Filter<T> bool(final boolean value) {
        return new NonMutatingFilter<T>() {
            @Override
            public boolean accepts(T item) {
                return value;
            }
        };
    }
103890
public static String getPrefixFromValue(String value) {
    if (value == null) {
      return null;
    } else if (value.contains(DELIMITER)) {
      String[] list = value.split(DELIMITER);
      if (list != null && list.length > 0) {
        return list[0].replaceAll("\u0000", "");
      } else {
        return null;
      }
    } else {
      return value.replaceAll("\u0000", "");
    }
  }
1143286
public Double getDefaultOnNull(Double value, Double defaultValue)
   {
      return (value == null ? defaultValue : value);
   }
934581
public static Integer assign(final Integer value, final Integer defaultValueIfNull) {
        return value != null ? value : defaultValueIfNull;
    }
15260
public function filter($value) {
    	    	
    	$value   = str_replace(["\r", "\r\n", "\n"], '', $value);
    	$decoded = json_decode($value,true);
    	if(is_null($decoded)){
    		return null;
    	}    	
    	
    	switch($this->options["format"]){
    	    case self::DECODED:
    	        return $decoded;
    	    case self::JSON:
    	        return $value;
    	    case self::SERIALIZED:
    	        return serialize($decoded);
    	    default:
    	        throw new FilterException("unknown format for JSON filter specified");
    	}
    }
687188
@SuppressWarnings("unchecked")
	private static <T> T maskNull(T value) {
		return (value == null) ? (T) NULL_VALUE : value;
	}
509237
public static Optional<String> tail(final String value) {
        return Optional.ofNullable(value).filter(v -> !v.isEmpty()).map(v -> last(v, v.length() - 1));
    }
1232715
public boolean isMatched(String value)
    {
        if (value == null)
            return false;
        if ((_match != null)) {
            for (int i = 0; i < _match.length; i++) {
                if (value.equals(_match[i]))
                    return true;
            }
        }
        else {
            if (_defaultSelections != null) {
                return (_defaultSelections.contains(value));
            }
        }

        return false;

    }
906240
public void replaceValues(List<Object> values) {
    Preconditions.checkArgument(values != null, "Values cannot be null");
    Preconditions.checkArgument(values.size() <= fields.size(), "Values cannot be larger than fields size");
    this.values = values;
  }
895556
public static Optional<String> getSpecifiedValue(@Nullable String value) {
        return isSpecified(value) ? Optional.ofNullable(value) : Optional.empty();
    }
1136565
public static <T> T isNull(final T value, final T replacement) {
		if (value == null) {
			return replacement;
		}
		return value;
	}
118356
protected boolean isMatch(String value)
        {
        String filter = getFilterString();
        int    len    = filter.length();

        return value.regionMatches(m_ignoreCase, 0, filter, 0, len);
        }