Returns the given <code>value</code>, if not null or undefined; otherwise, returns the given <code>defaultValue</code>.
973865
function(value, defaultValue) {
      var result = value === undefined || value === null ? defaultValue : value;

      return result;
    }
18512
public static int toInteger(Object value, int defaultValue) {
		if (value == null || value.toString().trim().equals("")) {
			return defaultValue;
		}
		if (value instanceof Integer) {
			return (Integer) value;
		}
		return (int) JKConversionUtil.toDouble(value);
	}
1159141
private int parseInteger(String value, int defaultValue)
	{
		try
		{
			return Integer.parseInt(value);
		}
		catch (NumberFormatException e)
		{
			return defaultValue;
		}
	}
160882
public static final boolean valueIsNotDefault(FieldType type, Object value)
   {
      boolean result = true;

      if (value == null)
      {
         result = false;
      }
      else
      {
         DataType dataType = type.getDataType();
         switch (dataType)
         {
            case BOOLEAN:
            {
               result = ((Boolean) value).booleanValue();
               break;
            }

            case CURRENCY:
            case NUMERIC:
            {
               result = !NumberHelper.equals(((Number) value).doubleValue(), 0.0, 0.00001);
               break;
            }

            case DURATION:
            {
               result = (((Duration) value).getDuration() != 0);
               break;
            }

            default:
            {
               break;
            }
         }
      }

      return result;
   }
1219301
public int getValue(String attributeName, int defaultValue) {
        A attribute = getAt(attributeName);
        Object attributeValue = (attribute == null) ? null : attribute.getValue();
        return (attributeValue == null) ? defaultValue : Integer.parseInt(attributeValue.toString());
    }
1063379
function $$getDefaultValue() {
      if (!injector) throw new Error("Injectable functions cannot be called at configuration time");
      var defaultValue = injector.invoke(config.$$fn);
      if (defaultValue !== null && defaultValue !== undefined && !self.type.is(defaultValue))
        throw new Error("Default value (" + defaultValue + ") for parameter '" + self.id + "' is not an instance of Type (" + self.type.name + ")");
      return defaultValue;
    }
591538
public static <T> T getOrDefaultValue(String primaryKey, T defaultValue) {
        Object val = CFG.get(primaryKey);
        return val == null ? defaultValue : (T) CompatibleTypeUtils.convert(val, defaultValue.getClass());
    }
377896
public Object get(String key, Object defaultValue) {
        Object value = get(key);
        return value == null ? defaultValue : value;
    }
621988
public static Object getPrimitiveDefaultValue(final Class<?> type) {
        
        Objects.requireNonNull(type, "type should not be null.");
        
        if(!type.isPrimitive()) {
            return null;
            
        } else if(boolean.class.isAssignableFrom(type)) {
            return false;
            
        } else if(char.class.isAssignableFrom(type)) {
            return '\u0000';
            
        } else if(byte.class.isAssignableFrom(type)) {
            return (byte)0;
            
        } else if(short.class.isAssignableFrom(type)) {
            return (short)0;
            
        } else if(int.class.isAssignableFrom(type)) {
            return 0;
            
        } else if(long.class.isAssignableFrom(type)) {
            return 0l;
            
        } else if(float.class.isAssignableFrom(type)) {
            return 0.0f;
            
        } else if(double.class.isAssignableFrom(type)) {
            return 0.0d;
        }
        
        return null;
        
    }
145770
@Override
	public Object getDefaultValue() {

		Indexed indexedAnnotation = getIndexAnnotation();
		if (indexedAnnotation != null && StringUtils.hasText(indexedAnnotation.defaultValue())) {
			return indexedAnnotation.defaultValue();
		}
		return null;
	}
255812
public static DefaultValueFunction defaultValue(Field field, Object defaultValue) {

		Assert.notNull(field, "Field must not be 'null' for default value operation.");

		return new DefaultValueFunction(field, defaultValue);
	}
28067
public String getDefaultReturnValue(HashMap<String,TypeMirror> typeBinding)
    {
        String returnType = getReturnType(typeBinding);
        if (_defaultReturnValues.containsKey(returnType))
            return _defaultReturnValues.get(returnType);
        return "null";
    }
612263
public int get(int key, int defaultValue) {
    int index = getKeyIndex(key);
    if (index >= 0) {
      return values[index];
    } else {
      return defaultValue;
    }
  }
473084
public static Object defaultValue(final Class<?> type) {
	final Object value = WRAPPER_DEFAULTS.get(Objects.requireNonNull(type));
	if (value == null) {
	    throw new IllegalArgumentException("Not primitive wrapper");
	}
	return value;
    }
1034312
public String getProperty(String key, String defaultValue) {
        String value = getProperty(key, String.class);
        return StringUtils.isEmpty(value) ? defaultValue : value;
    }
1238474
function() {
      
      var getDefaultValueForField = function (classObj, paramName) {
         var i, length = classObj.groupOptions.length, f;
         
         for(i = 0 ; i < length ; i++) {
            f = classObj.groupOptions[i];
            
            // Retro-compatibility with deprecated inputParams Object
            if(lang.isObject(f.inputParams) && f.inputParams.name == paramName) {
               return f.inputParams.value;
               
            // New prefered way to use field options
            } else if (f.name == paramName) {
               return f.value;
            }
         }
         return undefined;
      };
      
      
      // The field parameters
      var fieldParams = this.group.getValue();
      var classObj = inputEx.getFieldClass(this.typeSelect.getValue());
      
      // + default values
      for(var key in fieldParams) {
         if( fieldParams.hasOwnProperty(key) ) {
            var value1 = getDefaultValueForField(classObj, key);
            var value2 = fieldParams[key];
            if(value1 == value2) {
               fieldParams[key] = undefined;
            }
         }
      }
      
      // The field type
      fieldParams.type = this.typeSelect.getValue();
      
      // The value defined by the fieldValue
      if(this.fieldValue) fieldParams.value = this.fieldValue.getValue();
      
      return fieldParams;
   }
895556
public static Optional<String> getSpecifiedValue(@Nullable String value) {
        return isSpecified(value) ? Optional.ofNullable(value) : Optional.empty();
    }