001 package com.thaiopensource.validate;
002
003 import com.thaiopensource.validate.Flag;
004 import com.thaiopensource.util.PropertyId;
005 import com.thaiopensource.util.PropertyMapBuilder;
006
007 /**
008 * A PropertyId whose value is not significant. Its significance
009 * rests purely on whether it is present in a PropertyMap. The
010 * value is constrained to be Flag.PRESENT.
011 *
012 * @see Flag
013 */
014 public class FlagPropertyId extends PropertyId {
015 public FlagPropertyId(String name) {
016 super(name, Flag.class);
017 }
018
019 /**
020 * Adds this property to a PropertyMapBuilder. Modifies
021 * the PropertyMapBuilder so that this PropertyId is
022 * mapped to Flag.PRESENT.
023 *
024 * @param builder the PropertyMapBuilder to be modified
025 */
026 public void add(PropertyMapBuilder builder) {
027 builder.put(this, Flag.PRESENT);
028 }
029 }