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

org.requirementsascode.Actor Maven / Gradle / Ivy

There is a newer version: 2.0
Show newest version
package org.requirementsascode;

import java.util.Objects;

/**
 * An actor with dynamically attachable behavior.
 *
 * @author b_muth
 */
public class Actor extends AbstractActor{
	private Model behavior;
	
	/**
	 * Creates an actor with a name equal to the current class' simple name.
	 *
	 */
	public Actor() {
		super();
	}

	/**
	 * Creates an actor with the specified name.
	 *
	 * @param name  the name of the actor
	 */
	public Actor(String name) {
		super(name);
	}
	
	/**
	 * Attach the specified behavior to the actor.
	 * 
	 * @param behaviorModel the behvior the actor will show from now on
	 * 
	 * @return this actor
	 */
	public Actor withBehavior(Model behaviorModel) {
		this.behavior = Objects.requireNonNull(behaviorModel);
		return this;
	}
	
	@Override
	public Model behavior() {
		return behavior;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy