It is necessary to provide a holder class for InOut and Out process parameters.
It is not necessary to provide a "blank" instance to be filled in the process body, because the associated class does not have to have a non-parameterized constructor (enforcing this would be too restrictive).
Imagine a class for a response which requires a request object in its constructor.
I have developed a helper class for that in the parking lot booking scenario (at the end), it is necessary to introduce a support for it in the runtime.
package cz.cuni.mff.d3s.deeco.demo.parkinglotbooking;
import java.io.Serializable;
public class ProcessOutHolder<ItemType> implements Serializable {
private static final long serialVersionUID = 3526860113119876016L;
private ItemType item;
public ProcessOutHolder(ItemType item) {
this.item = item;
}
public ItemType get() {
return item;
}
public void set(ItemType newItem) {
item = newItem;
}
@Override
public boolean equals(Object obj) {
if ( this == obj )
return true;
if (obj == null)
return false;
if ( !(obj instanceof ProcessOutHolder<?>) )
return false;
ProcessOutHolder<?> other = (ProcessOutHolder<?>) obj;
return item == null ? other.item == null : item.equals(other.item);
}
@Override
public int hashCode() {
return item == null ? 0 : item.hashCode();
}
}
It is necessary to provide a holder class for InOut and Out process parameters. It is not necessary to provide a "blank" instance to be filled in the process body, because the associated class does not have to have a non-parameterized constructor (enforcing this would be too restrictive). Imagine a class for a response which requires a request object in its constructor.
I have developed a helper class for that in the parking lot booking scenario (at the end), it is necessary to introduce a support for it in the runtime.