View Javadoc

    1   package net.sourceforge.pmd.lang.rule.properties;
    2
    3   import java.io.File;
    4   import java.util.Map;
    5
    6   import net.sourceforge.pmd.PropertyDescriptorFactory;
    7   import net.sourceforge.pmd.lang.rule.properties.factories.BasicPropertyDescriptorFactory;
    8   import net.sourceforge.pmd.util.StringUtil;
    9   /**
    10   *
    11   * @author Brian Remedios
    12   */
    13  public class FileProperty extends AbstractProperty<File> {
    14
    15  	public static final PropertyDescriptorFactory FACTORY = new BasicPropertyDescriptorFactory<FileProperty>(File.class) {
    16
    17  		public FileProperty createWith(Map<String, String> valuesById) {
    18  			return new FileProperty(
    19  					nameIn(valuesById),
    20  					descriptionIn(valuesById),
    21  					null,
    22  					0f);
    23  		}
    24  	};
    25
    26  	public FileProperty(String theName, String theDescription, File theDefault, float theUIOrder) {
    27  		super(theName, theDescription, theDefault, theUIOrder);
    28  	}
    29
    30  	public Class<File> type() {
    31  		return File.class;
    32  	}
    33
    34  	public File valueFrom(String propertyString) throws IllegalArgumentException {
    35
    36  		return StringUtil.isEmpty(propertyString) ? null : new File(propertyString);
    37  	}
    38
    39  	@Override
    40  	protected String defaultAsString() {
    41  		// TODO Auto-generated method stub
    42  		return null;
    43  	}
    44
    45  }