Package ca.uhn.fhir.model.api
Class BasePrimitive<T>
- java.lang.Object
-
- ca.uhn.fhir.model.api.BaseElement
-
- ca.uhn.fhir.model.api.BaseIdentifiableElement
-
- ca.uhn.fhir.model.api.BasePrimitive<T>
-
- All Implemented Interfaces:
IDatatype,IElement,IIdentifiableElement,IPrimitiveDatatype<T>,ISupportsUndeclaredExtensions,Externalizable,Serializable,IBase,IBaseDatatype,IPrimitiveType<T>
- Direct Known Subclasses:
Base64BinaryDt,BaseDateTimeDt,BooleanDt,CodeDt,DecimalDt,IntegerDt,StringDt,UriDt,XhtmlDt
public abstract class BasePrimitive<T> extends BaseIdentifiableElement implements IPrimitiveDatatype<T>, Externalizable
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description BasePrimitive()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract Stringencode(T theValue)Subclasses must override to convert a "coerced" value into an encoded one.booleanequals(Object theObj)TgetValue()StringgetValueAsString()inthashCode()booleanhasValue()booleanisEmpty()protected abstract Tparse(String theValue)Subclasses must override to convert an encoded representation of this datatype into a "coerced" onevoidreadExternal(ObjectInput theIn)BasePrimitive<T>setValue(T theValue)voidsetValueAsString(String theValue)StringtoString()protected voidupdateStringValue()voidwriteExternal(ObjectOutput theOut)-
Methods inherited from class ca.uhn.fhir.model.api.BaseIdentifiableElement
getElementSpecificId, getId, setElementSpecificId, setId, setId
-
Methods inherited from class ca.uhn.fhir.model.api.BaseElement
addUndeclaredExtension, addUndeclaredExtension, addUndeclaredExtension, getAllUndeclaredExtensions, getFormatCommentsPost, getFormatCommentsPre, getUndeclaredExtensions, getUndeclaredExtensionsByUrl, getUndeclaredModifierExtensions, getUserData, hasFormatComment, isBaseEmpty, setUserData
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.hl7.fhir.instance.model.api.IBase
fhirType, getFormatCommentsPost, getFormatCommentsPre, getUserData, hasFormatComment, setUserData
-
-
-
-
Constructor Detail
-
BasePrimitive
public BasePrimitive()
-
-
Method Detail
-
encode
protected abstract String encode(T theValue)
Subclasses must override to convert a "coerced" value into an encoded one.- Parameters:
theValue- Will not be null- Returns:
- May return null if the value does not correspond to anything
-
getValue
public T getValue()
- Specified by:
getValuein interfaceIPrimitiveDatatype<T>- Specified by:
getValuein interfaceIPrimitiveType<T>
-
getValueAsString
public String getValueAsString() throws DataFormatException
- Specified by:
getValueAsStringin interfaceIPrimitiveDatatype<T>- Specified by:
getValueAsStringin interfaceIPrimitiveType<T>- Throws:
DataFormatException
-
parse
protected abstract T parse(String theValue)
Subclasses must override to convert an encoded representation of this datatype into a "coerced" one- Parameters:
theValue- Will not be null- Returns:
- May return null if the value does not correspond to anything
-
readExternal
public void readExternal(ObjectInput theIn) throws IOException, ClassNotFoundException
- Specified by:
readExternalin interfaceExternalizable- Throws:
IOExceptionClassNotFoundException
-
setValue
public BasePrimitive<T> setValue(T theValue) throws DataFormatException
- Specified by:
setValuein interfaceIPrimitiveDatatype<T>- Specified by:
setValuein interfaceIPrimitiveType<T>- Throws:
DataFormatException
-
setValueAsString
public void setValueAsString(String theValue) throws DataFormatException
- Specified by:
setValueAsStringin interfaceIPrimitiveDatatype<T>- Specified by:
setValueAsStringin interfaceIPrimitiveType<T>- Throws:
DataFormatException
-
updateStringValue
protected void updateStringValue()
-
writeExternal
public void writeExternal(ObjectOutput theOut) throws IOException
- Specified by:
writeExternalin interfaceExternalizable- Throws:
IOException
-
hasValue
public boolean hasValue()
- Specified by:
hasValuein interfaceIPrimitiveType<T>
-
-