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

org.javasimon.console.action.DetailPlugin Maven / Gradle / Ivy

There is a newer version: 4.2.0
Show newest version
package org.javasimon.console.action;

import org.javasimon.Simon;
import org.javasimon.console.ActionContext;
import org.javasimon.console.SimonConsolePlugin;
import org.javasimon.console.json.ObjectJS;
import org.javasimon.console.text.StringifierFactory;

import java.io.IOException;

/**
 * Base class for Detail plugins.
 *
 * @author gquintana
 */
public abstract class DetailPlugin extends SimonConsolePlugin {

	protected DetailPlugin(String id, String label) {
		super(id, label);
	}

	/**
	 * Indicates this plugin applies to this kind of Simon.
	 *
	 * @param simon Simon
	 * @return {@code true} if plugin can be executed
	 */
	public boolean supports(Simon simon) {
		return true;
	}

	/**
	 * Callback for flat HTML rendering.
	 *
	 * @param context Context (Request, parameters...)
	 * @param htmlBuilder HTML Builder (Response generation helper)
	 * @param simon Simon to render.
	 */
	public DetailHtmlBuilder executeHtml(ActionContext context, DetailHtmlBuilder htmlBuilder, StringifierFactory htmlStringifierFactory, Simon simon) throws IOException {
		return htmlBuilder;
	}

	/**
	 * Callback for flat JSON rendering.
	 *
	 * @param context Context (Request, parameters...)
	 * @param simon Simon to render
	 */
	public ObjectJS executeJson(ActionContext context, StringifierFactory jsonStringifierFactory, Simon simon) {
		return null;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy