001    package com.thaiopensource.validate;
002    
003    import com.thaiopensource.util.PropertyId;
004    
005    public class StringOption implements Option {
006      private final StringPropertyId pid;
007    
008      public StringOption(StringPropertyId pid) {
009        this.pid = pid;
010      }
011    
012      public PropertyId getPropertyId() {
013        return pid;
014      }
015    
016      public Object valueOf(String arg) throws OptionArgumentException {
017        if (arg == null)
018          return defaultValue();
019        return normalize(arg);
020      }
021    
022      public String defaultValue() throws OptionArgumentPresenceException {
023        throw new OptionArgumentPresenceException();
024      }
025    
026      public String normalize(String value) throws OptionArgumentFormatException {
027        return value;
028      }
029    
030      public Object combine(Object[] values) {
031        return null;
032      }
033    }