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

de.tsl2.nano.specification.rules.RuledEnabler Maven / Gradle / Ivy

Go to download

TSL2 Framework Specification (Pools of descripted and runnable Actions and Rules, Generic Tree)

The newest version!
package de.tsl2.nano.specification.rules;

import org.simpleframework.xml.Attribute;

import de.tsl2.nano.action.IActivable;
import de.tsl2.nano.bean.def.BeanValue;
import de.tsl2.nano.bean.def.IAttributeDefinition;
import de.tsl2.nano.core.ENV;
import de.tsl2.nano.core.util.Util;
import de.tsl2.nano.specification.Pool;

/**
 * NOT FINISHED YET! The injection of beanvalue after deserialization must be implemented!
 * 
 * @author ts
 */
public class RuledEnabler implements IActivable {
	transient BeanValue context;
	@Attribute
	String ruleName;

	RuledEnabler() {
	}

	public RuledEnabler(IAttributeDefinition attr, String ruleName) {
		this.ruleName = ruleName;
	}

	@Override
	public boolean isActive() {
		return Util.isTrue(ENV.get(Pool.class).get(ruleName).run(context));
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy