001 package ca.uhn.hl7v2.model; 002 003 /** 004 * An unspecified Primitive datatype that imposes no constraints on its string 005 * value. This is used to store Varies data, when the data type is unknown. It is also 006 * used to store unrecognized message constituents. 007 * @author Bryan Tripp 008 */ 009 public class GenericPrimitive extends AbstractPrimitive implements Primitive { 010 011 String value = null; 012 013 /** 014 * Creates a new instance of GenericPrimitive 015 */ 016 public GenericPrimitive(Message message) { 017 super(message); 018 } 019 020 /** 021 * Returns a String representation of the value of this field. 022 */ 023 public String getValue() { 024 return this.value; 025 } 026 027 /** 028 * Sets the value of this field if the given value is legal in the context of the 029 * implementing class. 030 * @throws DataTypeException if the given value is not valid in this context. 031 */ 032 public void setValue(String value) throws DataTypeException { 033 this.value = value; 034 } 035 036 /** Returns the name of the type (used in XML encoding and profile checking) */ 037 public String getName() { 038 return "UNKNOWN"; 039 } 040 041 /** 042 * @see ca.uhn.hl7v2.model.Primitive#getVersion() 043 */ 044 public String getVersion() { 045 return null; 046 } 047 }