All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cdc.mf.checks.IssueDescription Maven / Gradle / Ivy

The newest version!
package cdc.mf.checks;

import java.util.Collection;

import cdc.issues.StructuredDescription;
import cdc.mf.model.MfElement;
import cdc.mf.model.MfUtils;

public class IssueDescription extends StructuredDescription {
    protected IssueDescription(Builder builder) {
        super(builder);
    }

    public static IssueDescription.Builder builder() {
        return new IssueDescription.Builder();
    }

    public static class Builder extends StructuredDescription.Builder {
        protected Builder() {
            super();
        }

        /**
         * Appends an element as a list item.
         *
         * @param element The element.
         * @return This Builder.
         */
        public Builder element(MfElement element) {
            return uItem(MfUtils.identify(element));
        }

        /**
         * Appends an element as a list item at a given indentation level.
         *
         * @param level The list indentation level.
         * @param element The element.
         * @return This Builder.
         */
        public Builder element(int level,
                               MfElement element) {
            return uItem(level, MfUtils.identify(element));
        }

        /**
         * Appends a collection of elements as list items.
         *
         * @param elements The elements.
         * @return This Builder.
         */
        public Builder elements(Collection elements) {
            for (final MfElement element : elements) {
                element(element);
            }
            return self();
        }

        /**
         * Appends a collection of elements as list items at a given indentation level.
         *
         * @param level The list indentation level.
         * @param elements The elements.
         * @return This Builder.
         */
        public Builder elements(int level,
                                Collection elements) {
            for (final MfElement element : elements) {
                element(level, element);
            }
            return self();
        }

        @Override
        public IssueDescription build() {
            return new IssueDescription(this);
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy