Coverage Report - org.apache.commons.contract.descriptor.ParameterDescriptor
 
Classes in this File Line Coverage Branch Coverage Complexity
ParameterDescriptor
0%
0/20
0%
0/4
1.25
 
 1  
 package org.apache.commons.contract.descriptor;
 2  
 
 3  
 import org.apache.commons.contract.constraints.Constraints;
 4  
 import org.apache.commons.contract.i18n.ParameterBundle;
 5  
 
 6  
 public class ParameterDescriptor extends Descriptor {
 7  0
         public final static ParameterDescriptor[] NO_PARAMETERS = new ParameterDescriptor[0];
 8  
         
 9  
     protected Constraints constraints;
 10  
     protected Object defaultValue;
 11  
     protected boolean required;
 12  
 
 13  
     public ParameterDescriptor(String name, ParameterBundle description, Constraints valueDescriptor) {
 14  0
         super(name, description);
 15  0
         this.constraints = valueDescriptor;
 16  0
         this.required = true;
 17  0
     }
 18  
 
 19  
     public ParameterDescriptor(String name, ParameterBundle description, Constraints valueDescriptor, Object defaultValue) {
 20  0
         super(name, description);
 21  0
         this.constraints = valueDescriptor;
 22  0
         this.defaultValue  = defaultValue;
 23  0
         this.required = false;
 24  0
     }
 25  
 
 26  
     public boolean isRequired() {
 27  0
         return required;
 28  
     }
 29  
 
 30  
     public void setConstraints(Constraints valueDescriptor) {
 31  0
         this.constraints = valueDescriptor;
 32  0
     }
 33  
 
 34  
     public Constraints getConstraints() {
 35  0
         return constraints;
 36  
     }
 37  
 
 38  
     public void setDefaultValue(Object defaultValue) {
 39  0
         this.defaultValue = defaultValue;
 40  0
         this.required = true;
 41  0
     }
 42  
 
 43  
     public Object getDefaultValue() {
 44  0
         return defaultValue;
 45  
     }
 46  
     
 47  
     public boolean equals(Object o) {
 48  0
             if ( o instanceof ParameterDescriptor && ((ParameterDescriptor)o).getName().equals(getName())) return true;
 49  0
             return false;
 50  
     }
 51  
 }