001package ca.uhn.hl7v2.conf.spec.message;
002
003import ca.uhn.hl7v2.conf.ProfileException;
004
005/**
006 * An explicit data value specified in a message profile.  
007 * @author Bryan Tripp
008 */
009public class DataValue {
010    
011    /** Holds value of property exValue. */
012    private String exValue;
013    
014    /** Utility field used by bound properties. */
015    private java.beans.PropertyChangeSupport propertyChangeSupport =  new java.beans.PropertyChangeSupport(this);
016    
017    /** Utility field used by constrained properties. */
018    private java.beans.VetoableChangeSupport vetoableChangeSupport =  new java.beans.VetoableChangeSupport(this);
019    
020    /** Creates a new instance of DataValue */
021    public DataValue() {
022    }
023    
024    /** Adds a PropertyChangeListener to the listener list.
025     * @param l The listener to add.
026     */
027    public void addPropertyChangeListener(java.beans.PropertyChangeListener l) {
028        propertyChangeSupport.addPropertyChangeListener(l);
029    }
030    
031    /** Removes a PropertyChangeListener from the listener list.
032     * @param l The listener to remove.
033     */
034    public void removePropertyChangeListener(java.beans.PropertyChangeListener l) {
035        propertyChangeSupport.removePropertyChangeListener(l);
036    }
037    
038    /** Adds a VetoableChangeListener to the listener list.
039     * @param l The listener to add.
040     */
041    public void addVetoableChangeListener(java.beans.VetoableChangeListener l) {
042        vetoableChangeSupport.addVetoableChangeListener(l);
043    }
044    
045    /** Removes a VetoableChangeListener from the listener list.
046     * @param l The listener to remove.
047     */
048    public void removeVetoableChangeListener(java.beans.VetoableChangeListener l) {
049        vetoableChangeSupport.removeVetoableChangeListener(l);
050    }
051    
052    /** Getter for property exValue.
053     * @return Value of property exValue.
054     */
055    public String getExValue() {
056        return this.exValue;
057    }
058    
059    /** Setter for property exValue.
060     * @param exValue New value of property exValue.
061     *
062     * @throws ProfileException
063     */
064    public void setExValue(String exValue) throws ProfileException {
065        String oldExValue = this.exValue;
066        try {
067            vetoableChangeSupport.fireVetoableChange("exValue", oldExValue, exValue);
068        } catch (Exception e) {
069            throw new ProfileException(null, e);
070        }
071        this.exValue = exValue;
072        propertyChangeSupport.firePropertyChange("exValue", oldExValue, exValue);
073    }
074    
075}