private static <T, P extends Property<? super T>> boolean setPropertyIf(
            final Class<T> type,
            final Object value, // Nullable
            final Function<T, P> propertyGetter) {

        requireNonNull(type);
        requireNonNull(propertyGetter);
        
        if (type.isInstance(value)) {
            final T casted = type.cast(value);
            final P property = propertyGetter.apply(casted);
            
            if (!Objects.equals(casted, property.getValue())) {
                if (property.isBound()) {
                    throw new SpeedmentConfigException(
                        "Attempting to set bound " + 
                        type.getSimpleName() + "Property " +
                        " to new value '" + casted + "'."
                    );
                } else {
                    property.setValue(casted);
                }
            }

            return true;
        }

        return false;
    }
Sets a property generated with the specified getter to a value if it is
of the correct type and the setting would not break any bindings. If a
binding would be broken, a {@link SpeedmentException} is thrown.

@param <T>             the expected type of the value
@param <P>             the property type
@param type            the expected type of the value
@param value           the value or null
@param propertyGetter  getter for the property
@return                {@code true} if a value was set, else {@code false}
tool-parent/tool-config/src/main/java/com/speedment/tool/config/util/DocumentMerger.java