1 package com.thaiopensource.validate; 2 3 import com.thaiopensource.util.PropertyId; 4 5 public class StringOption implements Option { 6 private final StringPropertyId pid; 7 8 public StringOption(StringPropertyId pid) { 9 this.pid = pid; 10 } 11 12 public PropertyId getPropertyId() { 13 return pid; 14 } 15 16 public Object valueOf(String arg) throws OptionArgumentException { 17 if (arg == null) 18 return defaultValue(); 19 return normalize(arg); 20 } 21 22 public String defaultValue() throws OptionArgumentPresenceException { 23 throw new OptionArgumentPresenceException(); 24 } 25 26 public String normalize(String value) throws OptionArgumentFormatException { 27 return value; 28 } 29 30 public Object combine(Object [] values) { 31 return null; 32 } 33 } 34 | Popular Tags |