Corrections for PR #669
This commit is contained in:
@ -17,7 +17,7 @@ public class AvoidDeeplyNestedIfStmtsRule extends AbstractApexRule {
|
||||
private static final IntegerProperty PROBLEM_DEPTH_DESCRIPTOR
|
||||
= IntegerProperty.builder("problemDepth")
|
||||
.desc("The if statement depth reporting threshold")
|
||||
.min(1).max(25).defalt(3).uiOrder(1.0f).build();
|
||||
.range(1, 25).defaultValue(3).uiOrder(1.0f).build();
|
||||
|
||||
public AvoidDeeplyNestedIfStmtsRule() {
|
||||
definePropertyDescriptor(PROBLEM_DEPTH_DESCRIPTOR);
|
||||
|
@ -40,7 +40,7 @@ public class StdCyclomaticComplexityRule extends AbstractApexRule {
|
||||
public static final IntegerProperty REPORT_LEVEL_DESCRIPTOR
|
||||
= IntegerProperty.builder("reportLevel")
|
||||
.desc("Cyclomatic Complexity reporting threshold")
|
||||
.min(1).max(30).defalt(10).uiOrder(1.0f).build();
|
||||
.range(1, 30).defaultValue(10).uiOrder(1.0f).build();
|
||||
|
||||
public static final BooleanProperty SHOW_CLASSES_COMPLEXITY_DESCRIPTOR = new BooleanProperty(
|
||||
"showClassesComplexity", "Add class average violations to the report", true, 2.0f);
|
||||
|
@ -23,7 +23,7 @@ public class MockRule extends AbstractRule {
|
||||
public MockRule() {
|
||||
super();
|
||||
setLanguage(LanguageRegistry.getLanguage("Dummy"));
|
||||
definePropertyDescriptor(IntegerProperty.builder("testIntProperty").desc("testIntProperty").min(0).max(100).defalt(1).uiOrder(0).build());
|
||||
definePropertyDescriptor(IntegerProperty.builder("testIntProperty").desc("testIntProperty").range(0, 100).defaultValue(1).uiOrder(0).build());
|
||||
}
|
||||
|
||||
public MockRule(String name, String description, String message, String ruleSetName, RulePriority priority) {
|
||||
|
@ -69,20 +69,21 @@ public final class BooleanMultiProperty extends AbstractMultiValueProperty<Boole
|
||||
static PropertyDescriptorBuilderConversionWrapper.MultiValue<Boolean, BooleanMultiPBuilder> extractor() {
|
||||
return new PropertyDescriptorBuilderConversionWrapper.MultiValue<Boolean, BooleanMultiPBuilder>(Boolean.class, ValueParserConstants.BOOLEAN_PARSER) {
|
||||
@Override
|
||||
protected BooleanMultiPBuilder newBuilder() {
|
||||
return new BooleanMultiPBuilder();
|
||||
protected BooleanMultiPBuilder newBuilder(String name) {
|
||||
return new BooleanMultiPBuilder(name);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public static BooleanMultiPBuilder builder(String name) {
|
||||
return new BooleanMultiPBuilder().name(name);
|
||||
return new BooleanMultiPBuilder(name);
|
||||
}
|
||||
|
||||
|
||||
public static final class BooleanMultiPBuilder extends MultiValuePropertyBuilder<Boolean, BooleanMultiPBuilder> {
|
||||
private BooleanMultiPBuilder() {
|
||||
private BooleanMultiPBuilder(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
|
||||
|
@ -67,21 +67,21 @@ public final class BooleanProperty extends AbstractSingleValueProperty<Boolean>
|
||||
static PropertyDescriptorBuilderConversionWrapper.SingleValue<Boolean, BooleanPBuilder> extractor() {
|
||||
return new PropertyDescriptorBuilderConversionWrapper.SingleValue<Boolean, BooleanPBuilder>(Boolean.class, ValueParserConstants.BOOLEAN_PARSER) {
|
||||
@Override
|
||||
protected BooleanPBuilder newBuilder() {
|
||||
return new BooleanPBuilder();
|
||||
protected BooleanPBuilder newBuilder(String name) {
|
||||
return new BooleanPBuilder(name);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public static BooleanPBuilder builder(String name) {
|
||||
return new BooleanPBuilder().name(name);
|
||||
return new BooleanPBuilder(name);
|
||||
}
|
||||
|
||||
|
||||
public static final class BooleanPBuilder extends SingleValuePropertyBuilder<Boolean, BooleanPBuilder> {
|
||||
private BooleanPBuilder() {
|
||||
|
||||
private BooleanPBuilder(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
|
||||
|
@ -97,20 +97,21 @@ public final class CharacterMultiProperty extends AbstractMultiValueProperty<Cha
|
||||
static PropertyDescriptorBuilderConversionWrapper.MultiValue<Character, CharacterMultiPBuilder> extractor() {
|
||||
return new PropertyDescriptorBuilderConversionWrapper.MultiValue<Character, CharacterMultiPBuilder>(Character.class, ValueParserConstants.CHARACTER_PARSER) {
|
||||
@Override
|
||||
protected CharacterMultiPBuilder newBuilder() {
|
||||
return new CharacterMultiPBuilder();
|
||||
protected CharacterMultiPBuilder newBuilder(String name) {
|
||||
return new CharacterMultiPBuilder(name);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public static CharacterMultiPBuilder builder(String name) {
|
||||
return new CharacterMultiPBuilder().name(name);
|
||||
return new CharacterMultiPBuilder(name);
|
||||
}
|
||||
|
||||
|
||||
public static final class CharacterMultiPBuilder extends MultiValuePropertyBuilder<Character, CharacterMultiPBuilder> {
|
||||
private CharacterMultiPBuilder() {
|
||||
private CharacterMultiPBuilder(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
|
||||
|
@ -81,20 +81,21 @@ public final class CharacterProperty extends AbstractSingleValueProperty<Charact
|
||||
static PropertyDescriptorBuilderConversionWrapper.SingleValue<Character, CharacterPBuilder> extractor() {
|
||||
return new PropertyDescriptorBuilderConversionWrapper.SingleValue<Character, CharacterPBuilder>(Character.class, ValueParserConstants.CHARACTER_PARSER) {
|
||||
@Override
|
||||
protected CharacterPBuilder newBuilder() {
|
||||
return new CharacterPBuilder();
|
||||
protected CharacterPBuilder newBuilder(String name) {
|
||||
return new CharacterPBuilder(name);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public static CharacterPBuilder builder(String name) {
|
||||
return new CharacterPBuilder().name(name);
|
||||
return new CharacterPBuilder(name);
|
||||
}
|
||||
|
||||
|
||||
public static final class CharacterPBuilder extends SingleValuePropertyBuilder<Character, CharacterPBuilder> {
|
||||
private CharacterPBuilder() {
|
||||
private CharacterPBuilder(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
|
||||
|
@ -77,20 +77,21 @@ public final class DoubleMultiProperty extends AbstractMultiNumericProperty<Doub
|
||||
static PropertyDescriptorBuilderConversionWrapper.MultiValue.Numeric<Double, DoubleMultiPBuilder> extractor() {
|
||||
return new PropertyDescriptorBuilderConversionWrapper.MultiValue.Numeric<Double, DoubleMultiPBuilder>(Double.class, ValueParserConstants.DOUBLE_PARSER) {
|
||||
@Override
|
||||
protected DoubleMultiPBuilder newBuilder() {
|
||||
return new DoubleMultiPBuilder();
|
||||
protected DoubleMultiPBuilder newBuilder(String name) {
|
||||
return new DoubleMultiPBuilder(name);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public static DoubleMultiPBuilder builder(String name) {
|
||||
return new DoubleMultiPBuilder().name(name);
|
||||
return new DoubleMultiPBuilder(name);
|
||||
}
|
||||
|
||||
|
||||
public static final class DoubleMultiPBuilder extends MultiNumericPropertyBuilder<Double, DoubleMultiPBuilder> {
|
||||
private DoubleMultiPBuilder() {
|
||||
private DoubleMultiPBuilder(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
|
||||
|
@ -91,20 +91,21 @@ public final class DoubleProperty extends AbstractNumericProperty<Double> {
|
||||
static PropertyDescriptorBuilderConversionWrapper.SingleValue.Numeric<Double, DoublePBuilder> extractor() {
|
||||
return new PropertyDescriptorBuilderConversionWrapper.SingleValue.Numeric<Double, DoublePBuilder>(Double.class, ValueParserConstants.DOUBLE_PARSER) {
|
||||
@Override
|
||||
protected DoublePBuilder newBuilder() {
|
||||
return new DoublePBuilder();
|
||||
protected DoublePBuilder newBuilder(String name) {
|
||||
return new DoublePBuilder(name);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public static DoublePBuilder builder(String name) {
|
||||
return new DoublePBuilder().name(name);
|
||||
return new DoublePBuilder(name);
|
||||
}
|
||||
|
||||
|
||||
public static final class DoublePBuilder extends SingleNumericPropertyBuilder<Double, DoublePBuilder> {
|
||||
private DoublePBuilder() {
|
||||
private DoublePBuilder(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
|
||||
|
@ -24,7 +24,7 @@ import net.sourceforge.pmd.util.CollectionUtil;
|
||||
* @version Refactored June 2017 (6.0.0)
|
||||
*/
|
||||
public final class EnumeratedMultiProperty<E> extends AbstractMultiValueProperty<E>
|
||||
implements EnumeratedPropertyDescriptor<E, List<E>> {
|
||||
implements EnumeratedPropertyDescriptor<E, List<E>> {
|
||||
|
||||
|
||||
private final EnumeratedPropertyModule<E> module;
|
||||
@ -43,13 +43,13 @@ public final class EnumeratedMultiProperty<E> extends AbstractMultiValueProperty
|
||||
* @param theUIOrder UI order
|
||||
*
|
||||
* @deprecated Use {@link #EnumeratedMultiProperty(String, String, Map, List, Class, float)}. Will be removed in
|
||||
* 7.0.0
|
||||
* 7.0.0
|
||||
*/
|
||||
@Deprecated
|
||||
public EnumeratedMultiProperty(String theName, String theDescription, String[] theLabels, E[] theChoices,
|
||||
int[] choiceIndices, Class<E> valueType, float theUIOrder) {
|
||||
this(theName, theDescription, CollectionUtil.mapFrom(theLabels, theChoices),
|
||||
selection(choiceIndices, theChoices), valueType, theUIOrder, false);
|
||||
selection(choiceIndices, theChoices), valueType, theUIOrder, false);
|
||||
}
|
||||
|
||||
|
||||
@ -65,13 +65,13 @@ public final class EnumeratedMultiProperty<E> extends AbstractMultiValueProperty
|
||||
* @param theUIOrder UI order
|
||||
*
|
||||
* @deprecated Use {@link #EnumeratedMultiProperty(String, String, Map, List, Class, float)}. Will be removed in
|
||||
* 7.0.0
|
||||
* 7.0.0
|
||||
*/
|
||||
@Deprecated
|
||||
public EnumeratedMultiProperty(String theName, String theDescription, String[] theLabels, E[] theChoices,
|
||||
int[] choiceIndices, float theUIOrder) {
|
||||
this(theName, theDescription, CollectionUtil.mapFrom(theLabels, theChoices),
|
||||
selection(choiceIndices, theChoices), null, theUIOrder, false);
|
||||
selection(choiceIndices, theChoices), null, theUIOrder, false);
|
||||
}
|
||||
|
||||
|
||||
@ -157,7 +157,7 @@ public final class EnumeratedMultiProperty<E> extends AbstractMultiValueProperty
|
||||
|
||||
|
||||
public static <E> EnumMultiPBuilder<E> builder(String name, Class<E> type) {
|
||||
return new EnumMultiPBuilder<>(type).name(name);
|
||||
return new EnumMultiPBuilder<>(name, type);
|
||||
}
|
||||
|
||||
|
||||
@ -167,11 +167,19 @@ public final class EnumeratedMultiProperty<E> extends AbstractMultiValueProperty
|
||||
private Map<String, E> mappings;
|
||||
|
||||
|
||||
private EnumMultiPBuilder(Class<E> type) {
|
||||
private EnumMultiPBuilder(String name, Class<E> type) {
|
||||
super(name);
|
||||
this.valueType = type;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the key-value mappings.
|
||||
*
|
||||
* @param map A map of label to value
|
||||
*
|
||||
* @return The same builder
|
||||
*/
|
||||
public EnumMultiPBuilder<E> mappings(Map<String, E> map) {
|
||||
this.mappings = map;
|
||||
return this;
|
||||
|
@ -129,7 +129,7 @@ public final class EnumeratedProperty<E> extends AbstractSingleValueProperty<E>
|
||||
|
||||
|
||||
public static <E> EnumPBuilder<E> builder(String name, Class<E> type) {
|
||||
return new EnumPBuilder<>(type).name(name);
|
||||
return new EnumPBuilder<>(name, type);
|
||||
}
|
||||
|
||||
|
||||
@ -139,7 +139,8 @@ public final class EnumeratedProperty<E> extends AbstractSingleValueProperty<E>
|
||||
private Map<String, E> mappings;
|
||||
|
||||
|
||||
private EnumPBuilder(Class<E> type) {
|
||||
private EnumPBuilder(String name, Class<E> type) {
|
||||
super(name);
|
||||
this.valueType = type;
|
||||
}
|
||||
|
||||
|
@ -55,20 +55,21 @@ public final class FileProperty extends AbstractSingleValueProperty<File> {
|
||||
static PropertyDescriptorBuilderConversionWrapper.SingleValue<File, FilePBuilder> extractor() {
|
||||
return new PropertyDescriptorBuilderConversionWrapper.SingleValue<File, FilePBuilder>(File.class, ValueParserConstants.FILE_PARSER) {
|
||||
@Override
|
||||
protected FilePBuilder newBuilder() {
|
||||
return new FilePBuilder();
|
||||
protected FilePBuilder newBuilder(String name) {
|
||||
return new FilePBuilder(name);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public static FilePBuilder builder(String name) {
|
||||
return new FilePBuilder().name(name);
|
||||
return new FilePBuilder(name);
|
||||
}
|
||||
|
||||
|
||||
public static final class FilePBuilder extends SinglePackagedPropertyBuilder<File, FilePBuilder> {
|
||||
private FilePBuilder() {
|
||||
private FilePBuilder(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
|
||||
|
@ -78,20 +78,21 @@ public final class FloatMultiProperty extends AbstractMultiNumericProperty<Float
|
||||
static PropertyDescriptorBuilderConversionWrapper.MultiValue.Numeric<Float, FloatMultiPBuilder> extractor() {
|
||||
return new PropertyDescriptorBuilderConversionWrapper.MultiValue.Numeric<Float, FloatMultiPBuilder>(Float.class, ValueParserConstants.FLOAT_PARSER) {
|
||||
@Override
|
||||
protected FloatMultiPBuilder newBuilder() {
|
||||
return new FloatMultiPBuilder();
|
||||
protected FloatMultiPBuilder newBuilder(String name) {
|
||||
return new FloatMultiPBuilder(name);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public static FloatMultiPBuilder builder(String name) {
|
||||
return new FloatMultiPBuilder().name(name);
|
||||
return new FloatMultiPBuilder(name);
|
||||
}
|
||||
|
||||
|
||||
public static final class FloatMultiPBuilder extends MultiNumericPropertyBuilder<Float, FloatMultiPBuilder> {
|
||||
private FloatMultiPBuilder() {
|
||||
private FloatMultiPBuilder(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
|
||||
|
@ -79,20 +79,21 @@ public final class FloatProperty extends AbstractNumericProperty<Float> {
|
||||
static PropertyDescriptorBuilderConversionWrapper.SingleValue.Numeric<Float, FloatPBuilder> extractor() {
|
||||
return new PropertyDescriptorBuilderConversionWrapper.SingleValue.Numeric<Float, FloatPBuilder>(Float.class, ValueParserConstants.FLOAT_PARSER) {
|
||||
@Override
|
||||
protected FloatPBuilder newBuilder() {
|
||||
return new FloatPBuilder();
|
||||
protected FloatPBuilder newBuilder(String name) {
|
||||
return new FloatPBuilder(name);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public static FloatPBuilder builder(String name) {
|
||||
return new FloatPBuilder().name(name);
|
||||
return new FloatPBuilder(name);
|
||||
}
|
||||
|
||||
|
||||
public static final class FloatPBuilder extends SingleNumericPropertyBuilder<Float, FloatPBuilder> {
|
||||
private FloatPBuilder() {
|
||||
private FloatPBuilder(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
|
||||
|
@ -80,20 +80,21 @@ public final class IntegerMultiProperty extends AbstractMultiNumericProperty<Int
|
||||
static PropertyDescriptorBuilderConversionWrapper.MultiValue.Numeric<Integer, IntegerMultiPBuilder> extractor() {
|
||||
return new PropertyDescriptorBuilderConversionWrapper.MultiValue.Numeric<Integer, IntegerMultiPBuilder>(Integer.class, ValueParserConstants.INTEGER_PARSER) {
|
||||
@Override
|
||||
protected IntegerMultiPBuilder newBuilder() {
|
||||
return new IntegerMultiPBuilder();
|
||||
protected IntegerMultiPBuilder newBuilder(String name) {
|
||||
return new IntegerMultiPBuilder(name);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public static IntegerMultiPBuilder builder(String name) {
|
||||
return new IntegerMultiPBuilder().name(name);
|
||||
return new IntegerMultiPBuilder(name);
|
||||
}
|
||||
|
||||
|
||||
public static final class IntegerMultiPBuilder extends MultiNumericPropertyBuilder<Integer, IntegerMultiPBuilder> {
|
||||
private IntegerMultiPBuilder() {
|
||||
private IntegerMultiPBuilder(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
|
||||
|
@ -58,20 +58,21 @@ public final class IntegerProperty extends AbstractNumericProperty<Integer> {
|
||||
static PropertyDescriptorBuilderConversionWrapper.SingleValue.Numeric<Integer, IntegerPBuilder> extractor() {
|
||||
return new PropertyDescriptorBuilderConversionWrapper.SingleValue.Numeric<Integer, IntegerPBuilder>(Integer.class, ValueParserConstants.INTEGER_PARSER) {
|
||||
@Override
|
||||
protected IntegerPBuilder newBuilder() {
|
||||
return new IntegerPBuilder();
|
||||
protected IntegerPBuilder newBuilder(String name) {
|
||||
return new IntegerPBuilder(name);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public static IntegerPBuilder builder(String name) {
|
||||
return new IntegerPBuilder().name(name);
|
||||
return new IntegerPBuilder(name);
|
||||
}
|
||||
|
||||
|
||||
public static final class IntegerPBuilder extends SingleNumericPropertyBuilder<Integer, IntegerPBuilder> {
|
||||
private IntegerPBuilder() {
|
||||
private IntegerPBuilder(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
|
||||
|
@ -78,25 +78,30 @@ public final class LongMultiProperty extends AbstractMultiNumericProperty<Long>
|
||||
static PropertyDescriptorBuilderConversionWrapper.MultiValue.Numeric<Long, LongMultiPBuilder> extractor() {
|
||||
return new PropertyDescriptorBuilderConversionWrapper.MultiValue.Numeric<Long, LongMultiPBuilder>(Long.class, ValueParserConstants.LONG_PARSER) {
|
||||
@Override
|
||||
protected LongMultiPBuilder newBuilder() {
|
||||
return new LongMultiPBuilder();
|
||||
protected LongMultiPBuilder newBuilder(String name) {
|
||||
return new LongMultiPBuilder(name);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public static LongMultiPBuilder builder(String name) {
|
||||
return new LongMultiPBuilder().name(name);
|
||||
return new LongMultiPBuilder(name);
|
||||
}
|
||||
|
||||
|
||||
private static final class LongMultiPBuilder
|
||||
extends MultiNumericPropertyBuilder<Long, LongMultiPBuilder> {
|
||||
extends MultiNumericPropertyBuilder<Long, LongMultiPBuilder> {
|
||||
|
||||
protected LongMultiPBuilder(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public LongMultiProperty build() {
|
||||
return new LongMultiProperty(name, description, lowerLimit, upperLimit,
|
||||
defaultValues, uiOrder, isDefinedInXML);
|
||||
defaultValues, uiOrder, isDefinedInXML);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -78,20 +78,21 @@ public final class LongProperty extends AbstractNumericProperty<Long> {
|
||||
static PropertyDescriptorBuilderConversionWrapper.SingleValue.Numeric<Long, LongPBuilder> extractor() {
|
||||
return new PropertyDescriptorBuilderConversionWrapper.SingleValue.Numeric<Long, LongPBuilder>(Long.class, ValueParserConstants.LONG_PARSER) {
|
||||
@Override
|
||||
protected LongPBuilder newBuilder() {
|
||||
return new LongPBuilder();
|
||||
protected LongPBuilder newBuilder(String name) {
|
||||
return new LongPBuilder(name);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public static LongPBuilder builder(String name) {
|
||||
return new LongPBuilder().name(name);
|
||||
return new LongPBuilder(name);
|
||||
}
|
||||
|
||||
|
||||
public static final class LongPBuilder extends SingleNumericPropertyBuilder<Long, LongPBuilder> {
|
||||
private LongPBuilder() {
|
||||
private LongPBuilder(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
|
||||
|
@ -63,7 +63,7 @@ public final class MethodMultiProperty extends AbstractMultiPackagedProperty<Met
|
||||
private MethodMultiProperty(String theName, String theDescription, List<Method> theDefaults,
|
||||
String[] legalPackageNames, float theUIOrder, boolean isDefinedExternally) {
|
||||
super(theName, theDescription, theDefaults, theUIOrder, isDefinedExternally,
|
||||
new MethodPropertyModule(legalPackageNames, theDefaults));
|
||||
new MethodPropertyModule(legalPackageNames, theDefaults));
|
||||
}
|
||||
|
||||
|
||||
@ -82,9 +82,9 @@ public final class MethodMultiProperty extends AbstractMultiPackagedProperty<Met
|
||||
public MethodMultiProperty(String theName, String theDescription, String methodDefaults,
|
||||
String[] legalPackageNames, float theUIOrder) {
|
||||
this(theName, theDescription,
|
||||
methodsFrom(methodDefaults),
|
||||
legalPackageNames, theUIOrder,
|
||||
false);
|
||||
methodsFrom(methodDefaults),
|
||||
legalPackageNames, theUIOrder,
|
||||
false);
|
||||
}
|
||||
|
||||
|
||||
@ -120,20 +120,21 @@ public final class MethodMultiProperty extends AbstractMultiPackagedProperty<Met
|
||||
static PropertyDescriptorBuilderConversionWrapper.MultiValue.Packaged<Method, MethodMultiPBuilder> extractor() {
|
||||
return new PropertyDescriptorBuilderConversionWrapper.MultiValue.Packaged<Method, MethodMultiPBuilder>(Method.class, ValueParserConstants.METHOD_PARSER) {
|
||||
@Override
|
||||
protected MethodMultiPBuilder newBuilder() {
|
||||
return new MethodMultiPBuilder();
|
||||
protected MethodMultiPBuilder newBuilder(String name) {
|
||||
return new MethodMultiPBuilder(name);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public static MethodMultiPBuilder builder(String name) {
|
||||
return new MethodMultiPBuilder().name(name);
|
||||
return new MethodMultiPBuilder(name);
|
||||
}
|
||||
|
||||
|
||||
public static final class MethodMultiPBuilder extends MultiPackagedPropertyBuilder<Method, MethodMultiPBuilder> {
|
||||
private MethodMultiPBuilder() {
|
||||
private MethodMultiPBuilder(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
|
||||
|
@ -46,7 +46,7 @@ public final class MethodProperty extends AbstractPackagedProperty<Method> {
|
||||
private MethodProperty(String theName, String theDescription, Method theDefault, String[] legalPackageNames,
|
||||
float theUIOrder, boolean isDefinedExternally) {
|
||||
super(theName, theDescription, theDefault, theUIOrder, isDefinedExternally,
|
||||
new MethodPropertyModule(legalPackageNames, Collections.singletonList(theDefault)));
|
||||
new MethodPropertyModule(legalPackageNames, Collections.singletonList(theDefault)));
|
||||
}
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ public final class MethodProperty extends AbstractPackagedProperty<Method> {
|
||||
public MethodProperty(String theName, String theDescription, String defaultMethodStr, String[] legalPackageNames,
|
||||
float theUIOrder) {
|
||||
this(theName, theDescription, METHOD_PARSER.valueOf(defaultMethodStr),
|
||||
legalPackageNames, theUIOrder, false);
|
||||
legalPackageNames, theUIOrder, false);
|
||||
}
|
||||
|
||||
|
||||
@ -89,20 +89,21 @@ public final class MethodProperty extends AbstractPackagedProperty<Method> {
|
||||
static PropertyDescriptorBuilderConversionWrapper.SingleValue.Packaged<Method, MethodPBuilder> extractor() {
|
||||
return new PropertyDescriptorBuilderConversionWrapper.SingleValue.Packaged<Method, MethodPBuilder>(Method.class, ValueParserConstants.METHOD_PARSER) {
|
||||
@Override
|
||||
protected MethodPBuilder newBuilder() {
|
||||
return new MethodPBuilder();
|
||||
protected MethodPBuilder newBuilder(String name) {
|
||||
return new MethodPBuilder(name);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public static MethodPBuilder builder(String name) {
|
||||
return new MethodPBuilder().name(name);
|
||||
return new MethodPBuilder(name);
|
||||
}
|
||||
|
||||
|
||||
public static final class MethodPBuilder extends SinglePackagedPropertyBuilder<Method, MethodPBuilder> {
|
||||
private MethodPBuilder() {
|
||||
private MethodPBuilder(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
|
||||
|
@ -140,20 +140,21 @@ public final class StringMultiProperty extends AbstractMultiValueProperty<String
|
||||
static PropertyDescriptorBuilderConversionWrapper.MultiValue<String, StringMultiPBuilder> extractor() {
|
||||
return new PropertyDescriptorBuilderConversionWrapper.MultiValue<String, StringMultiPBuilder>(String.class, ValueParserConstants.STRING_PARSER) {
|
||||
@Override
|
||||
protected StringMultiPBuilder newBuilder() {
|
||||
return new StringMultiPBuilder();
|
||||
protected StringMultiPBuilder newBuilder(String name) {
|
||||
return new StringMultiPBuilder(name);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public static StringMultiPBuilder builder(String name) {
|
||||
return new StringMultiPBuilder().name(name);
|
||||
return new StringMultiPBuilder(name);
|
||||
}
|
||||
|
||||
|
||||
public static final class StringMultiPBuilder extends MultiValuePropertyBuilder<String, StringMultiPBuilder> {
|
||||
private StringMultiPBuilder() {
|
||||
private StringMultiPBuilder(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
|
||||
|
@ -31,7 +31,7 @@ public final class StringProperty extends AbstractSingleValueProperty<String> {
|
||||
|
||||
/** Master constructor. */
|
||||
private StringProperty(String theName, String theDescription, String defaultValue, float theUIOrder, boolean
|
||||
isDefinedExternally) {
|
||||
isDefinedExternally) {
|
||||
super(theName, theDescription, defaultValue, theUIOrder, isDefinedExternally);
|
||||
}
|
||||
|
||||
@ -51,20 +51,21 @@ public final class StringProperty extends AbstractSingleValueProperty<String> {
|
||||
static PropertyDescriptorBuilderConversionWrapper.SingleValue<String, StringPBuilder> extractor() {
|
||||
return new PropertyDescriptorBuilderConversionWrapper.SingleValue<String, StringPBuilder>(String.class, ValueParserConstants.STRING_PARSER) {
|
||||
@Override
|
||||
protected StringPBuilder newBuilder() {
|
||||
return new StringPBuilder();
|
||||
protected StringPBuilder newBuilder(String name) {
|
||||
return new StringPBuilder(name);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public static StringPBuilder builder(String name) {
|
||||
return new StringPBuilder().name(name);
|
||||
return new StringPBuilder(name);
|
||||
}
|
||||
|
||||
|
||||
public static final class StringPBuilder extends SingleValuePropertyBuilder<String, StringPBuilder> {
|
||||
private StringPBuilder() {
|
||||
private StringPBuilder(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
|
||||
|
@ -43,7 +43,7 @@ public final class TypeMultiProperty extends AbstractMultiPackagedProperty<Class
|
||||
private TypeMultiProperty(String theName, String theDescription, List<Class> theTypeDefaults,
|
||||
String[] legalPackageNames, float theUIOrder, boolean isDefinedExternally) {
|
||||
super(theName, theDescription, theTypeDefaults, theUIOrder, isDefinedExternally,
|
||||
new TypePropertyModule(legalPackageNames, theTypeDefaults));
|
||||
new TypePropertyModule(legalPackageNames, theTypeDefaults));
|
||||
}
|
||||
|
||||
|
||||
@ -61,8 +61,8 @@ public final class TypeMultiProperty extends AbstractMultiPackagedProperty<Class
|
||||
public TypeMultiProperty(String theName, String theDescription, String theTypeDefaults,
|
||||
String[] legalPackageNames, float theUIOrder) {
|
||||
this(theName, theDescription, typesFrom(theTypeDefaults),
|
||||
legalPackageNames,
|
||||
theUIOrder, false);
|
||||
legalPackageNames,
|
||||
theUIOrder, false);
|
||||
|
||||
}
|
||||
|
||||
@ -99,20 +99,22 @@ public final class TypeMultiProperty extends AbstractMultiPackagedProperty<Class
|
||||
public static PropertyDescriptorBuilderConversionWrapper.MultiValue.Packaged<Class, TypeMultiPBuilder> extractor() {
|
||||
return new PropertyDescriptorBuilderConversionWrapper.MultiValue.Packaged<Class, TypeMultiPBuilder>(Class.class, ValueParserConstants.CLASS_PARSER) {
|
||||
@Override
|
||||
protected TypeMultiPBuilder newBuilder() {
|
||||
return new TypeMultiPBuilder();
|
||||
protected TypeMultiPBuilder newBuilder(String name) {
|
||||
return new TypeMultiPBuilder(name);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public static TypeMultiPBuilder builder(String name) {
|
||||
return new TypeMultiPBuilder().name(name);
|
||||
return new TypeMultiPBuilder(name);
|
||||
}
|
||||
|
||||
|
||||
public static final class TypeMultiPBuilder extends MultiPackagedPropertyBuilder<Class, TypeMultiPBuilder> {
|
||||
private TypeMultiPBuilder() {
|
||||
|
||||
private TypeMultiPBuilder(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,7 +42,7 @@ public final class TypeProperty extends AbstractPackagedProperty<Class> {
|
||||
private TypeProperty(String theName, String theDescription, Class<?> theDefault, String[] legalPackageNames,
|
||||
float theUIOrder, boolean isDefinedExternally) {
|
||||
super(theName, theDescription, theDefault, theUIOrder, isDefinedExternally,
|
||||
new TypePropertyModule(legalPackageNames, Collections.<Class>singletonList(theDefault)));
|
||||
new TypePropertyModule(legalPackageNames, Collections.<Class>singletonList(theDefault)));
|
||||
}
|
||||
|
||||
|
||||
@ -82,20 +82,21 @@ public final class TypeProperty extends AbstractPackagedProperty<Class> {
|
||||
static PropertyDescriptorBuilderConversionWrapper.SingleValue.Packaged<Class, TypePBuilder> extractor() {
|
||||
return new PropertyDescriptorBuilderConversionWrapper.SingleValue.Packaged<Class, TypePBuilder>(Class.class, ValueParserConstants.CLASS_PARSER) {
|
||||
@Override
|
||||
protected TypePBuilder newBuilder() {
|
||||
return new TypePBuilder();
|
||||
protected TypePBuilder newBuilder(String name) {
|
||||
return new TypePBuilder(name);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public static TypePBuilder builder(String name) {
|
||||
return new TypePBuilder().name(name);
|
||||
return new TypePBuilder(name);
|
||||
}
|
||||
|
||||
|
||||
public static final class TypePBuilder extends SinglePackagedPropertyBuilder<Class, TypePBuilder> {
|
||||
private TypePBuilder() {
|
||||
private TypePBuilder(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
|
||||
|
@ -14,42 +14,31 @@ import net.sourceforge.pmd.properties.MultiValuePropertyDescriptor;
|
||||
* @param <T> Concrete type of the underlying builder
|
||||
*/
|
||||
public abstract class MultiNumericPropertyBuilder<V, T extends MultiNumericPropertyBuilder<V, T>>
|
||||
extends MultiValuePropertyBuilder<V, T> {
|
||||
extends MultiValuePropertyBuilder<V, T> {
|
||||
|
||||
|
||||
protected V lowerLimit;
|
||||
protected V upperLimit;
|
||||
|
||||
|
||||
protected MultiNumericPropertyBuilder() {
|
||||
protected MultiNumericPropertyBuilder(String name) {
|
||||
super(name);
|
||||
multiValueDelimiter = MultiValuePropertyDescriptor.DEFAULT_NUMERIC_DELIMITER;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Specify a minimum value.
|
||||
* Specify the range of acceptable values.
|
||||
*
|
||||
* @param val Value
|
||||
* @param min Lower bound
|
||||
* @param max Upper bound
|
||||
*
|
||||
* @return The same builder
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public T min(V val) {
|
||||
this.lowerLimit = val;
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Specify a maximum value.
|
||||
*
|
||||
* @param val Value
|
||||
*
|
||||
* @return The same builder
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public T max(V val) {
|
||||
this.upperLimit = val;
|
||||
public T range(V min, V max) {
|
||||
this.lowerLimit = min;
|
||||
this.upperLimit = max;
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,11 @@ public abstract class MultiPackagedPropertyBuilder<V, T extends MultiPackagedPro
|
||||
protected String[] legalPackageNames;
|
||||
|
||||
|
||||
protected MultiPackagedPropertyBuilder(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public T legalPackages(String[] packs) {
|
||||
if (packs != null) {
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
package net.sourceforge.pmd.properties.builders;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import net.sourceforge.pmd.properties.MultiValuePropertyDescriptor;
|
||||
@ -16,12 +17,17 @@ import net.sourceforge.pmd.properties.MultiValuePropertyDescriptor;
|
||||
* @param <T> Concrete type of the underlying builder
|
||||
*/
|
||||
public abstract class MultiValuePropertyBuilder<V, T extends MultiValuePropertyBuilder<V, T>>
|
||||
extends PropertyDescriptorBuilder<List<V>, T> {
|
||||
extends PropertyDescriptorBuilder<List<V>, T> {
|
||||
|
||||
protected List<V> defaultValues;
|
||||
protected char multiValueDelimiter = MultiValuePropertyDescriptor.DEFAULT_DELIMITER;
|
||||
|
||||
|
||||
protected MultiValuePropertyBuilder(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Specify a default value.
|
||||
*
|
||||
@ -30,12 +36,26 @@ public abstract class MultiValuePropertyBuilder<V, T extends MultiValuePropertyB
|
||||
* @return The same builder
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public T defalt(List<V> val) {
|
||||
public T defaultValues(List<V> val) {
|
||||
this.defaultValues = val;
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Specify default values.
|
||||
*
|
||||
* @param val List of values
|
||||
*
|
||||
* @return The same builder
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public T defaultValues(V... val) {
|
||||
this.defaultValues = Arrays.asList(val);
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Specify a delimiter character. By default it's {@link MultiValuePropertyDescriptor#DEFAULT_DELIMITER}, or {@link
|
||||
* MultiValuePropertyDescriptor#DEFAULT_NUMERIC_DELIMITER} for numeric properties.
|
||||
|
@ -27,22 +27,13 @@ public abstract class PropertyDescriptorBuilder<E, T extends PropertyDescriptorB
|
||||
protected boolean isDefinedInXML = false;
|
||||
|
||||
|
||||
/**
|
||||
* Specify the name of the property.
|
||||
*
|
||||
* @param name The name
|
||||
*
|
||||
* @return The same builder
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public T name(String name) {
|
||||
protected PropertyDescriptorBuilder(String name) {
|
||||
if (StringUtils.isBlank(name)) {
|
||||
throw new IllegalArgumentException("Name must be provided");
|
||||
}
|
||||
this.name = name;
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Specify the description of the property.
|
||||
|
@ -30,7 +30,7 @@ import net.sourceforge.pmd.properties.ValueParserConstants;
|
||||
* @since 6.0.0
|
||||
*/
|
||||
public abstract class PropertyDescriptorBuilderConversionWrapper<E, T extends PropertyDescriptorBuilder<E, T>>
|
||||
implements PropertyDescriptorExternalBuilder<E> {
|
||||
implements PropertyDescriptorExternalBuilder<E> {
|
||||
|
||||
private final Class<?> valueType;
|
||||
|
||||
@ -42,7 +42,6 @@ public abstract class PropertyDescriptorBuilderConversionWrapper<E, T extends Pr
|
||||
|
||||
/** Populates the builder with extracted fields. To be overridden. */
|
||||
protected void populate(T builder, Map<PropertyDescriptorField, String> fields) {
|
||||
builder.name(fields.get(PropertyDescriptorField.NAME));
|
||||
builder.desc(fields.get(PropertyDescriptorField.DESCRIPTION));
|
||||
if (fields.containsKey(PropertyDescriptorField.UI_ORDER)) {
|
||||
builder.uiOrder(Float.parseFloat(fields.get(PropertyDescriptorField.UI_ORDER)));
|
||||
@ -58,12 +57,12 @@ public abstract class PropertyDescriptorBuilderConversionWrapper<E, T extends Pr
|
||||
}
|
||||
|
||||
|
||||
protected abstract T newBuilder(); // FUTURE 1.8: use a Supplier constructor parameter
|
||||
protected abstract T newBuilder(String name); // FUTURE 1.8: use a Supplier constructor parameter
|
||||
|
||||
|
||||
@Override
|
||||
public PropertyDescriptor<E> build(Map<PropertyDescriptorField, String> fields) {
|
||||
T builder = newBuilder();
|
||||
T builder = newBuilder(fields.get(PropertyDescriptorField.NAME));
|
||||
populate(builder, fields);
|
||||
builder.isDefinedInXML = true;
|
||||
return builder.build();
|
||||
@ -100,7 +99,7 @@ public abstract class PropertyDescriptorBuilderConversionWrapper<E, T extends Pr
|
||||
* @param <T> Concrete type of the underlying builder
|
||||
*/
|
||||
public abstract static class MultiValue<V, T extends MultiValuePropertyBuilder<V, T>>
|
||||
extends PropertyDescriptorBuilderConversionWrapper<List<V>, T> {
|
||||
extends PropertyDescriptorBuilderConversionWrapper<List<V>, T> {
|
||||
|
||||
protected final ValueParser<V> parser;
|
||||
|
||||
@ -115,8 +114,8 @@ public abstract class PropertyDescriptorBuilderConversionWrapper<E, T extends Pr
|
||||
protected void populate(T builder, Map<PropertyDescriptorField, String> fields) {
|
||||
super.populate(builder, fields);
|
||||
char delim = delimiterIn(fields, builder.multiValueDelimiter);
|
||||
builder.delim(delim).defalt(ValueParserConstants.multi(parser, delim)
|
||||
.valueOf(fields.get(PropertyDescriptorField.DEFAULT_VALUE)));
|
||||
builder.delim(delim).defaultValues(ValueParserConstants.multi(parser, delim)
|
||||
.valueOf(fields.get(PropertyDescriptorField.DEFAULT_VALUE)));
|
||||
}
|
||||
|
||||
|
||||
@ -133,7 +132,7 @@ public abstract class PropertyDescriptorBuilderConversionWrapper<E, T extends Pr
|
||||
* @param <T> Concrete type of the underlying builder
|
||||
*/
|
||||
public abstract static class Numeric<V, T extends MultiNumericPropertyBuilder<V, T>>
|
||||
extends MultiValue<V, T> {
|
||||
extends MultiValue<V, T> {
|
||||
|
||||
protected Numeric(Class<V> valueType, ValueParser<V> parser) {
|
||||
super(valueType, parser);
|
||||
@ -143,8 +142,9 @@ public abstract class PropertyDescriptorBuilderConversionWrapper<E, T extends Pr
|
||||
@Override
|
||||
protected void populate(T builder, Map<PropertyDescriptorField, String> fields) {
|
||||
super.populate(builder, fields);
|
||||
builder.min(parser.valueOf(fields.get(PropertyDescriptorField.MIN)));
|
||||
builder.max(parser.valueOf(fields.get(PropertyDescriptorField.MAX)));
|
||||
V min = parser.valueOf(fields.get(PropertyDescriptorField.MIN));
|
||||
V max = parser.valueOf(fields.get(PropertyDescriptorField.MAX));
|
||||
builder.range(min, max);
|
||||
}
|
||||
}
|
||||
|
||||
@ -156,7 +156,7 @@ public abstract class PropertyDescriptorBuilderConversionWrapper<E, T extends Pr
|
||||
* @param <T> Concrete type of the underlying builder
|
||||
*/
|
||||
public abstract static class Packaged<V, T extends MultiPackagedPropertyBuilder<V, T>>
|
||||
extends MultiValue<V, T> {
|
||||
extends MultiValue<V, T> {
|
||||
|
||||
protected Packaged(Class<V> valueType, ValueParser<V> parser) {
|
||||
super(valueType, parser);
|
||||
@ -167,7 +167,7 @@ public abstract class PropertyDescriptorBuilderConversionWrapper<E, T extends Pr
|
||||
protected void populate(T builder, Map<PropertyDescriptorField, String> fields) {
|
||||
super.populate(builder, fields);
|
||||
builder.legalPackages(legalPackageNamesIn(fields, PropertyDescriptorBuilderConversionWrapper.delimiterIn(fields,
|
||||
MultiValuePropertyDescriptor.DEFAULT_DELIMITER)));
|
||||
MultiValuePropertyDescriptor.DEFAULT_DELIMITER)));
|
||||
}
|
||||
}
|
||||
|
||||
@ -181,7 +181,7 @@ public abstract class PropertyDescriptorBuilderConversionWrapper<E, T extends Pr
|
||||
* @param <T> Concrete type of the underlying builder
|
||||
*/
|
||||
public abstract static class SingleValue<E, T extends SingleValuePropertyBuilder<E, T>>
|
||||
extends PropertyDescriptorBuilderConversionWrapper<E, T> {
|
||||
extends PropertyDescriptorBuilderConversionWrapper<E, T> {
|
||||
|
||||
protected final ValueParser<E> parser;
|
||||
|
||||
@ -195,7 +195,7 @@ public abstract class PropertyDescriptorBuilderConversionWrapper<E, T extends Pr
|
||||
@Override
|
||||
protected void populate(T builder, Map<PropertyDescriptorField, String> fields) {
|
||||
super.populate(builder, fields);
|
||||
builder.defalt(parser.valueOf(fields.get(PropertyDescriptorField.DEFAULT_VALUE)));
|
||||
builder.defaultValue(parser.valueOf(fields.get(PropertyDescriptorField.DEFAULT_VALUE)));
|
||||
}
|
||||
|
||||
|
||||
@ -208,13 +208,13 @@ public abstract class PropertyDescriptorBuilderConversionWrapper<E, T extends Pr
|
||||
/**
|
||||
* For single-value numeric properties.
|
||||
*
|
||||
* @param <E> Element type of the list
|
||||
* @param <V> Element type of the list
|
||||
* @param <T> Concrete type of the underlying builder
|
||||
*/
|
||||
public abstract static class Numeric<E, T extends SingleNumericPropertyBuilder<E, T>>
|
||||
extends SingleValue<E, T> {
|
||||
public abstract static class Numeric<V, T extends SingleNumericPropertyBuilder<V, T>>
|
||||
extends SingleValue<V, T> {
|
||||
|
||||
protected Numeric(Class<E> valueType, ValueParser<E> parser) {
|
||||
protected Numeric(Class<V> valueType, ValueParser<V> parser) {
|
||||
super(valueType, parser);
|
||||
}
|
||||
|
||||
@ -222,8 +222,9 @@ public abstract class PropertyDescriptorBuilderConversionWrapper<E, T extends Pr
|
||||
@Override
|
||||
protected void populate(T builder, Map<PropertyDescriptorField, String> fields) {
|
||||
super.populate(builder, fields);
|
||||
builder.min(parser.valueOf(fields.get(PropertyDescriptorField.MIN)));
|
||||
builder.max(parser.valueOf(fields.get(PropertyDescriptorField.MAX)));
|
||||
V min = parser.valueOf(fields.get(PropertyDescriptorField.MIN));
|
||||
V max = parser.valueOf(fields.get(PropertyDescriptorField.MAX));
|
||||
builder.range(min, max);
|
||||
}
|
||||
}
|
||||
|
||||
@ -235,7 +236,7 @@ public abstract class PropertyDescriptorBuilderConversionWrapper<E, T extends Pr
|
||||
* @param <T> Concrete type of the underlying builder
|
||||
*/
|
||||
public abstract static class Packaged<E, T extends SinglePackagedPropertyBuilder<E, T>>
|
||||
extends SingleValue<E, T> {
|
||||
extends SingleValue<E, T> {
|
||||
|
||||
protected Packaged(Class<E> valueType, ValueParser<E> parser) {
|
||||
super(valueType, parser);
|
||||
@ -246,7 +247,7 @@ public abstract class PropertyDescriptorBuilderConversionWrapper<E, T extends Pr
|
||||
protected void populate(T builder, Map<PropertyDescriptorField, String> fields) {
|
||||
super.populate(builder, fields);
|
||||
builder.legalPackageNames(legalPackageNamesIn(fields, PropertyDescriptorBuilderConversionWrapper.delimiterIn(fields,
|
||||
MultiValuePropertyDescriptor.DEFAULT_DELIMITER)));
|
||||
MultiValuePropertyDescriptor.DEFAULT_DELIMITER)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,37 +9,31 @@ package net.sourceforge.pmd.properties.builders;
|
||||
* @since 6.0.0
|
||||
*/
|
||||
public abstract class SingleNumericPropertyBuilder<V, T extends SingleNumericPropertyBuilder<V, T>>
|
||||
extends SingleValuePropertyBuilder<V, T> {
|
||||
extends SingleValuePropertyBuilder<V, T> {
|
||||
|
||||
|
||||
protected V lowerLimit;
|
||||
protected V upperLimit;
|
||||
|
||||
|
||||
/**
|
||||
* Specify a minimum value.
|
||||
*
|
||||
* @param val Value
|
||||
*
|
||||
* @return The same builder
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public T min(V val) {
|
||||
this.lowerLimit = val;
|
||||
return (T) this;
|
||||
public SingleNumericPropertyBuilder(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Specify a maximum value.
|
||||
* Specify the range of acceptable values.
|
||||
*
|
||||
* @param val Value
|
||||
* @param min Lower bound
|
||||
* @param max Upper bound
|
||||
*
|
||||
* @return The same builder
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public T max(V val) {
|
||||
this.upperLimit = val;
|
||||
public T range(V min, V max) {
|
||||
this.lowerLimit = min;
|
||||
this.upperLimit = max;
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user