Package net.sourceforge.pmd.properties
Class PropertyBuilder.GenericCollectionPropertyBuilder<V,C extends java.util.Collection<V>>
- java.lang.Object
-
- net.sourceforge.pmd.properties.PropertyBuilder<PropertyBuilder.GenericCollectionPropertyBuilder<V,C>,C>
-
- net.sourceforge.pmd.properties.PropertyBuilder.GenericCollectionPropertyBuilder<V,C>
-
- Type Parameters:
V- Component type of the collectionC- Collection type for the property being built
- Enclosing class:
- PropertyBuilder<B extends PropertyBuilder<B,T>,T>
public static final class PropertyBuilder.GenericCollectionPropertyBuilder<V,C extends java.util.Collection<V>> extends PropertyBuilder<PropertyBuilder.GenericCollectionPropertyBuilder<V,C>,C>
Generic builder for a collection-valued property. This class adds methods related todefaultValue(Collection)to make its use more flexible. See e.g.defaultValues(Object, Object[]).Note: this is designed to support arbitrary collections. Pre-7.0.0, the only collections available from the
PropertyFactoryare list types though.- Since:
- 6.10.0
- Author:
- Clément Fournier
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.sourceforge.pmd.properties.PropertyBuilder
PropertyBuilder.GenericCollectionPropertyBuilder<V,C extends java.util.Collection<V>>, PropertyBuilder.GenericPropertyBuilder<T>, PropertyBuilder.RegexPropertyBuilder
-
-
Field Summary
-
Fields inherited from class net.sourceforge.pmd.properties.PropertyBuilder
isDefinedExternally
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description PropertyDescriptor<C>build()Builds the descriptor and returns it.PropertyBuilder.GenericCollectionPropertyBuilder<V,C>defaultValue(java.util.Collection<? extends V> val)Specify a default value.PropertyBuilder.GenericCollectionPropertyBuilder<V,C>defaultValues(V head, V... tail)Specify default values.PropertyBuilder.GenericCollectionPropertyBuilder<V,C>delim(char delim)Deprecated.PMD 7.0.0 will introduce a new XML syntax for multi-valued properties which will not rely on delimiters.PropertyBuilder.GenericCollectionPropertyBuilder<V,C>emptyDefaultValue()Specify that the default value is an empty collection.PropertyBuilder.GenericCollectionPropertyBuilder<V,C>requireEach(PropertyConstraint<? super V> constraint)Require that the given constraint be fulfilled on each item of the value of this property.-
Methods inherited from class net.sourceforge.pmd.properties.PropertyBuilder
defaultValue, desc, getName, require
-
-
-
-
Method Detail
-
defaultValue
public PropertyBuilder.GenericCollectionPropertyBuilder<V,C> defaultValue(java.util.Collection<? extends V> val)
Specify a default value.- Parameters:
val- List of values- Returns:
- The same builder
-
defaultValues
public PropertyBuilder.GenericCollectionPropertyBuilder<V,C> defaultValues(V head, V... tail)
Specify default values. To specify an empty default value, useemptyDefaultValue().- Parameters:
head- First valuetail- Rest of the values- Returns:
- The same builder
-
emptyDefaultValue
public PropertyBuilder.GenericCollectionPropertyBuilder<V,C> emptyDefaultValue()
Specify that the default value is an empty collection.- Returns:
- The same builder
-
requireEach
public PropertyBuilder.GenericCollectionPropertyBuilder<V,C> requireEach(PropertyConstraint<? super V> constraint)
Require that the given constraint be fulfilled on each item of the value of this property. This is a convenient shorthand forrequire(constraint.toCollectionConstraint()).- Parameters:
constraint- Constraint to impose on the items of the collection value- Returns:
- The same builder
-
delim
@Deprecated public PropertyBuilder.GenericCollectionPropertyBuilder<V,C> delim(char delim)
Deprecated.PMD 7.0.0 will introduce a new XML syntax for multi-valued properties which will not rely on delimiters. This method is kept until this is implemented for compatibility reasons with the pre-7.0.0 framework, but it will be scrapped come 7.0.0.Specify a delimiter character. By default it'sMultiValuePropertyDescriptor.DEFAULT_DELIMITER, orMultiValuePropertyDescriptor.DEFAULT_NUMERIC_DELIMITERfor numeric properties.- Parameters:
delim- Delimiter- Returns:
- The same builder
-
build
public PropertyDescriptor<C> build()
Description copied from class:PropertyBuilderBuilds the descriptor and returns it.- Specified by:
buildin classPropertyBuilder<PropertyBuilder.GenericCollectionPropertyBuilder<V,C extends java.util.Collection<V>>,C extends java.util.Collection<V>>- Returns:
- The built descriptor
-
-