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

org.daisy.common.messaging.MessageAccessor Maven / Gradle / Ivy

There is a newer version: 6.1.0
Show newest version
package org.daisy.common.messaging;

import java.util.List;
import java.util.Set;

import org.daisy.common.messaging.Message.Level;


/**
 * Gives access to the stored messages by level.
 */
public abstract class MessageAccessor{

	/**
	 * Gets the errors.
	 *
	 * @return the error messages
	 */

	public List getErrors() {
		return getMessagesFrom(Level.ERROR);
	}

	/**
	 * Gets the warnings.
	 *
	 * @return the warning messages
	 */
	public List getWarnings(){
		return getMessagesFrom(Level.WARNING);
	}

	/**
	 * Gets the infos.
	 *
	 * @return the info messages
	 */
	public List getInfos(){
		return getMessagesFrom(Level.INFO);
	};

	/**
	 * Gets the debugs.
	 *
	 * @return the debug messages
	 */
	public List getDebugs(){
		return getMessagesFrom(Level.DEBUG);
	}



	/**
	 * Gets the traces.
	 *
	 * @return the trace messages
	 */
	public List getTraces(){
		return getMessagesFrom(Level.TRACE);
	}

	/**
	 * Gets the messgages from a set of levels
	 *
	 * @param fromLevels levels
	 * @return the messages
	 */

	public abstract List getAll();
	protected abstract List getMessagesFrom(Level level);
	public abstract boolean delete();


	public abstract MessageFilter createFilter();

	public interface  MessageFilter{
		public MessageFilter filterLevels(Set levels);
		public MessageFilter greaterThan(int sequence);
		public MessageFilter inRange(int start, int end);
		public List getMessages();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy