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

org.objectweb.fractal.bf.adl.common.ParameterVerifier Maven / Gradle / Ivy

There is a newer version: 0.9
Show newest version
package org.objectweb.fractal.bf.adl.common;

import java.util.logging.Logger;

import org.objectweb.fractal.adl.ADLException;

public class ParameterVerifier {

	static Logger log = Logger.getLogger(ParameterVerifier.class
			.getCanonicalName());

	private ParameterVerifier() {
	}

	/**
	 * @param pc
	 * @throws ADLException
	 */
	public static void verify(ParameterContainer pc) throws ADLException {
		if (pc.getParameters().length > 0) {
			for (Parameter p : pc.getParameters()) {
				log.config("ADL Parameter to be verified: [" + p.getName()
						+ ":" + p.getValue() + "] ");
				if ((p.getName() == null) || (p.getName().equalsIgnoreCase(""))) {

					throw new ADLException(
							"The name of a parameter can't be empty");

				} else if (p.getValue() == null
						|| p.getValue().equalsIgnoreCase("")) {
					throw new ADLException("The value for parameter '"
							+ p.getName() + "' can't be empty");
				}
			}
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy