io.github.mmm.property.builder.lang.ComparablePropertyBuilder Maven / Gradle / Ivy
/* Copyright (c) The m-m-m Team, Licensed under the Apache License, Version 2.0
* http://www.apache.org/licenses/LICENSE-2.0 */
package io.github.mmm.property.builder.lang;
import io.github.mmm.property.AttributeReadOnly;
import io.github.mmm.property.Property;
import io.github.mmm.property.builder.PropertyBuilder;
import io.github.mmm.property.number.integers.IntegerProperty;
import io.github.mmm.property.object.SimpleProperty;
import io.github.mmm.validation.main.ObjectValidatorBuilder;
/**
* {@link PropertyBuilder} for {@link IntegerProperty}.
*
* @param type of the {@link Property#get() property value}.
* @param type of the {@link Property} to build.
* @param type of the {@link ObjectValidatorBuilder validator builder} for {@link #withValidator()}.
* @param type of this {@link ComparablePropertyBuilder} itself.
* @since 1.0.0
*/
public abstract class ComparablePropertyBuilder, P extends Property, B extends ObjectValidatorBuilder, ?>, SELF extends ComparablePropertyBuilder>
extends PropertyBuilder {
/**
* The constructor.
*
* @param lock the {@link #getLock() lock}.
*/
public ComparablePropertyBuilder(AttributeReadOnly lock) {
super(lock);
}
/**
* @return a {@link RangePropertyBuilder} using {@link #build(String) this property configuration} for its bounds (min
* and max).
*/
@SuppressWarnings("unchecked")
public RangePropertyBuilder asRange() {
return builder(new RangePropertyBuilder<>(this.lock, (SimpleProperty) build("Value", true)));
}
}