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

org.jacoco.maven.RuleConfiguration Maven / Gradle / Ivy

Go to download

The JaCoCo Maven Plugin provides the JaCoCo runtime agent to your tests and allows basic report creation.

There is a newer version: 0.8.12
Show newest version
/*******************************************************************************
 * Copyright (c) 2009, 2019 Mountainminds GmbH & Co. KG and Contributors
 * This program and the accompanying materials are made available under
 * the terms of the Eclipse Public License 2.0 which is available at
 * http://www.eclipse.org/legal/epl-2.0
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *    Evgeny Mandrikov - initial API and implementation
 *    Kyle Lieber - implementation of CheckMojo
 *    Marc Hoffmann - redesign using report APIs
 *
 *******************************************************************************/
package org.jacoco.maven;

import java.util.List;

import org.codehaus.plexus.util.StringUtils;
import org.jacoco.core.analysis.ICoverageNode.ElementType;
import org.jacoco.report.check.Limit;
import org.jacoco.report.check.Rule;

/**
 * Wrapper for {@link Rule} objects to allow Maven style includes/excludes lists
 *
 */
public class RuleConfiguration {

	final Rule rule;

	/**
	 * Create a new configuration instance.
	 */
	public RuleConfiguration() {
		rule = new Rule();
	}

	/**
	 * @param element
	 *            element type this rule applies to TODO: use ElementType
	 *            directly once Maven 3 is required.
	 */
	public void setElement(final String element) {
		rule.setElement(ElementType.valueOf(element));
	}

	/**
	 * @param includes
	 *            includes patterns
	 */
	public void setIncludes(final List includes) {
		rule.setIncludes(StringUtils.join(includes.iterator(), ":"));
	}

	/**
	 *
	 * @param excludes
	 *            excludes patterns
	 */
	public void setExcludes(final List excludes) {
		rule.setExcludes(StringUtils.join(excludes.iterator(), ":"));
	}

	/**
	 * @param limits
	 *            list of {@link Limit}s configured for this rule
	 */
	public void setLimits(final List limits) {
		rule.setLimits(limits);
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy