protected void updateStringValue() { if (myCoercedValue == null) { myStringValue = null; } else { // NB this might be null myStringValue = encode(myCoercedValue); } }
/** * Note that as of HAPI FHIR 3.1.0, this method no longer uses * the StAX XMLEvent type as the XML representation, and uses a * String instead. If you need to work with XML as StAX events, you * can use the {@link XmlUtil#parse(String)} and {@link XmlUtil#encode(List)} * methods to do so. */ @Override public String getValue() { return super.getValue(); }
@Override public void writeExternal(ObjectOutput theOut) throws IOException { theOut.writeObject(getValueAsString()); } }
@Override public boolean isEmpty() { return super.isBaseEmpty() && isBlank(getValueAsString()); }
/** * Note that as of HAPI FHIR 3.1.0, this method no longer uses * the StAX XMLEvent type as the XML representation, and uses a * String instead. If you need to work with XML as StAX events, you * can use the {@link XmlUtil#parse(String)} and {@link XmlUtil#encode(List)} * methods to do so. */ @Override public BasePrimitive<String> setValue(String theValue) throws DataFormatException { return super.setValue(theValue); }
@Override public void readExternal(ObjectInput theIn) throws IOException, ClassNotFoundException { String object = (String) theIn.readObject(); setValueAsString(object); }
@Override public BasePrimitive<T> setValue(T theValue) throws DataFormatException { myCoercedValue = theValue; updateStringValue(); return this; }
@Override public void setValueAsString(String theValue) throws DataFormatException { if (theValue == null) { myCoercedValue = null; } else { // NB this might be null myCoercedValue = parse(theValue); } myStringValue = theValue; }
/** * Returns <code>true</code> if this datatype has no extensions, and has either a <code>null</code> value or an empty ("") value. */ @Override public boolean isEmpty() { boolean retVal = super.isBaseEmpty() && StringUtils.isBlank(getValue()); return retVal; }
private void setFieldValue(int theField, int theValue, String theFractionalSeconds, int theMinimum, int theMaximum) { validateValueInRange(theValue, theMinimum, theMaximum); Calendar cal; if (getValue() == null) { cal = new GregorianCalendar(0, 0, 0); } else { cal = getValueAsCalendar(); } if (theField != -1) { cal.set(theField, theValue); } if (theFractionalSeconds != null) { myFractionalSeconds = theFractionalSeconds; } else if (theField == Calendar.MILLISECOND) { myFractionalSeconds = StringUtils.leftPad(Integer.toString(theValue), 3, '0'); } super.setValue(cal.getTime()); }
@Override public void setValueAsString(String theValue) throws DataFormatException { clearTimeZone(); super.setValueAsString(theValue); }
@Override public BasePrimitive<T> setValue(T theValue) throws DataFormatException { myCoercedValue = theValue; updateStringValue(); return this; }
@Override public void setValueAsString(String theValue) throws DataFormatException { if (theValue == null) { myCoercedValue = null; } else { // NB this might be null myCoercedValue = parse(theValue); } myStringValue = theValue; }
@Override public boolean isEmpty() { return super.isBaseEmpty() && (getValue() == null || getValue().isEmpty()); }
/** * Sets the value for this type using the given Java Date object as the time, and using the specified precision, as * well as the local timezone as determined by the local operating system. Both of * these properties may be modified in subsequent calls if neccesary. * * @param theValue * The date value * @param thePrecision * The precision * @throws DataFormatException */ public void setValue(Date theValue, TemporalPrecisionEnum thePrecision) throws DataFormatException { if (getTimeZone() == null) { setTimeZone(TimeZone.getDefault()); } myPrecision = thePrecision; myFractionalSeconds = ""; if (theValue != null) { long millis = theValue.getTime() % 1000; if (millis < 0) { // This is for times before 1970 (see bug #444) millis = 1000 + millis; } String fractionalSeconds = Integer.toString((int) millis); myFractionalSeconds = StringUtils.leftPad(fractionalSeconds, 3, '0'); } super.setValue(theValue); }
/** * Accepts a textual DIV and parses it into XHTML events which are stored internally. * <p> * <b>Formatting note:</b> The text will be trimmed {@link String#trim()}. If the text does not start with an HTML tag (generally this would be a div tag), a div tag will be automatically placed * surrounding the text. * </p> * <p> * Also note that if the parsed text contains any entities (&foo;) which are not a part of the entities defined in core XML (e.g. &sect; which is valid in XHTML 1.0 but not in XML 1.0) they * will be parsed and converted to their equivalent unicode character. * </p> */ @Override public void setValueAsString(String theValue) throws DataFormatException { if (theValue == null || theValue.isEmpty()) { super.setValueAsString(null); } else { String value = theValue.trim(); value = preprocessXhtmlNamespaceDeclaration(value); super.setValueAsString(value); } }
@Override public String toString() { return getClass().getSimpleName() + "[" + getValueAsString() + "]"; }
protected void updateStringValue() { if (myCoercedValue == null) { myStringValue = null; } else { // NB this might be null myStringValue = encode(myCoercedValue); } }
@Override public int hashCode() { return new HashCodeBuilder().append(getValue()).toHashCode(); }