Class PropertyBuilder<B extends PropertyBuilder<B,​T>,​T>

    • Field Detail

      • isDefinedExternally

        protected boolean isDefinedExternally
    • Method Detail

      • desc

        public B desc​(String desc)
        Specify the description of the property. This is used for documentation. Please describe precisely how the property may change the behaviour of the rule. Providing complete information should be preferred over being concise.

        Calling this method is required for build() to succeed.

        Parameters:
        desc - The description
        Returns:
        The same builder
        Throws:
        IllegalArgumentException - If the description is null or whitespace
      • require

        public B require​(PropertyConstraint<? super T> constraint)
        Add a constraint on the values that this property may take. The validity of values will be checked when parsing the XML, and invalid values will be reported. A rule will never be run if some of its properties violate some constraints.
        Parameters:
        constraint - The constraint
        Returns:
        The same builder
        See Also:
        NumericConstraints
      • build

        public abstract PropertyDescriptor<T> build()
        Builds the descriptor and returns it.
        Returns:
        The built descriptor
        Throws:
        IllegalArgumentException - if the description or default value were not provided, or if the default value doesn't satisfy the given constraints
      • getName

        public String getName()
        Returns the name of the property to be built.