View Javadoc

1   package net.sf.msplice.model;
2   
3   import org.apache.commons.logging.Log;
4   import org.apache.commons.logging.LogFactory;
5   
6   import net.sf.msplice.SpliceException;
7   import net.sf.msplice.model.condition.AbstractCondition;
8   import net.sf.msplice.model.condition.NoCondition;
9   import net.sf.msplice.visitor.IVisitor;
10  
11  public class DefaultConditionHolder implements ISpliceElement {
12  
13  	private final static Log LOG = LogFactory
14  			.getLog(DefaultConditionHolder.class);
15  
16  	public static final AbstractCondition FALLBACK_CONDITION = new NoCondition();
17  
18  	private AbstractCondition defaultCondition = FALLBACK_CONDITION;
19  
20  	// --------------------------------------------------------------------------------
21  	// visitable implementation
22  	// --------------------------------------------------------------------------------
23  
24  	public Object accept(IVisitor visitor) throws SpliceException {
25  		return visitor.visit(this);
26  	}
27  
28  	// --------------------------------------------------------------------------------
29  	// 
30  	// --------------------------------------------------------------------------------
31  
32  	public AbstractCondition getDefaultCondition() {
33  		return defaultCondition;
34  	}
35  
36  	public void setDefaultCondition(AbstractCondition condition) {
37  		if (condition == null) {
38  			LOG.warn("Impossible to set a \"null\" condition");
39  			this.defaultCondition = FALLBACK_CONDITION;
40  		} else {
41  			this.defaultCondition = condition;
42  		}
43  	}
44  
45  }