1 package org.apache.slide.projector.descriptor; 2 3 import org.apache.slide.projector.i18n.LocalizedMessage; 4 import org.apache.slide.projector.value.Value; 5 6 public class ParameterDescriptor extends Descriptor { 7 public final static ParameterDescriptor[] NO_PARAMETERS = new ParameterDescriptor[0]; 8 9 protected ValueDescriptor valueDescriptor; 10 protected Value defaultValue; 11 12 public ParameterDescriptor(String name, LocalizedMessage description, ValueDescriptor valueDescriptor) { 13 super(name, description); 14 this.valueDescriptor = valueDescriptor; 15 } 16 17 public ParameterDescriptor(String name, LocalizedMessage description, ValueDescriptor valueDescriptor, Value defaultValue) { 18 super(name, description); 19 this.valueDescriptor = valueDescriptor; 20 this.defaultValue = defaultValue; 21 } 22 23 public boolean isRequired() { 24 return ( defaultValue == null ); 25 } 26 27 public void setValueDescriptor(ValueDescriptor valueDescriptor) { 28 this.valueDescriptor = valueDescriptor; 29 } 30 31 public ValueDescriptor getValueDescriptor() { 32 return valueDescriptor; 33 } 34 35 public void setDefaultValue(Value defaultValue) { 36 this.defaultValue = defaultValue; 37 } 38 39 public Value getDefaultValue() { 40 return defaultValue; 41 } 42 43 public boolean equals(Object o) { 44 if ( o instanceof ParameterDescriptor && ((ParameterDescriptor)o).getName().equals(getName())) return true; 45 return false; 46 } 47 } | Popular Tags |