public T getValueAsEnum() { Validate.notNull(myBinder, "This object does not have a binder. Constructor BoundCodeDt() should not be called!"); T retVal = myBinder.fromCodeString(getValue()); if (retVal == null) { // TODO: throw special exception type? } return retVal; }
/** * Sets the {@link #getCoding()} to contain a coding with the code and * system defined by the given enumerated type, AND clearing any existing * codings first. If theValue is null, existing codings are cleared and no * codings are added. * * @param theValue * The value to add, or <code>null</code> */ public void setValueAsEnum(T theValue) { Validate.notNull(myBinder, "This object does not have a binder. Constructor BoundCodeableConceptDt() should not be called!"); getCoding().clear(); if (theValue == null) { return; } getCoding().add(new CodingDt(myBinder.toSystemString(theValue), myBinder.toCodeString(theValue))); }
public void setValueAsEnum(T theValue) { Validate.notNull(myBinder, "This object does not have a binder. Constructor BoundCodeDt() should not be called!"); if (theValue==null) { setValue(null); } else { setValue(myBinder.toCodeString(theValue)); } }
private static <T extends Enum<?>> String extractSystem(BoundCodeDt<T> theBoundCode) { if (theBoundCode.getValueAsEnum() != null) { IValueSetEnumBinder<T> binder = theBoundCode.getBinder(); return binder.toSystemString(theBoundCode.getValueAsEnum()); } return null; }
public void setValueAsEnum(T theValue) { Validate.notNull(myBinder, "This object does not have a binder. Constructor BoundCodeDt() should not be called!"); if (theValue==null) { setValue(null); } else { setValue(myBinder.toCodeString(theValue)); } }
@SuppressWarnings("unchecked") private static <T extends Enum<?>> T getEnumFromMetadataOrNullIfNone(Map<ResourceMetadataKeyEnum<?>, Object> theResourceMetadata, ResourceMetadataKeyEnum<T> theKey, Class<T> theEnumType, IValueSetEnumBinder<T> theBinder) { Object retValObj = theResourceMetadata.get(theKey); if (retValObj == null) { return null; } else if (theEnumType.equals(retValObj.getClass())) { return (T) retValObj; } else if (retValObj instanceof String) { return theBinder.fromCodeString((String) retValObj); } throw new InternalErrorException("Found an object of type '" + retValObj.getClass().getCanonicalName() + "' in resource metadata for key " + theKey.name() + " - Expected " + InstantDt.class.getCanonicalName()); }
/** * Sets the {@link #getCoding()} to contain a coding with the code and * system defined by the given enumerated types, AND clearing any existing * codings first. If theValue is null, existing codings are cleared and no * codings are added. * * @param theValues * The value to add, or <code>null</code> */ public void setValueAsEnum(Collection<T> theValues) { Validate.notNull(myBinder, "This object does not have a binder. Constructor BoundCodeableConceptDt() should not be called!"); getCoding().clear(); if (theValues != null) { for (T next : theValues) { getCoding().add(new CodingDt(myBinder.toSystemString(next), myBinder.toCodeString(next))); } } }
/** * Loops through the {@link #getCoding() codings} in this codeable concept * and returns the first bound enumerated type that matches. <b>Use * caution</b> using this method, see the return description for more * information. * * @return Returns the bound enumerated type, or <code>null</code> if none * are found. Note that a null return value doesn't neccesarily * imply that this Codeable Concept has no codes, only that it has * no codes that match the enum. */ public Set<T> getValueAsEnum() { Validate.notNull(myBinder, "This object does not have a binder. Constructor BoundCodeableConceptDt() should not be called!"); Set<T> retVal = new HashSet<T>(); for (CodingDt next : getCoding()) { if (next == null) { continue; } T nextT = myBinder.fromCodeString(defaultString(next.getCodeElement().getValue()), defaultString(next.getSystemElement().getValueAsString())); if (nextT != null) { retVal.add(nextT); } else { // TODO: throw special exception type? } } return retVal; }
/** * Sets the {@link #getCoding()} to contain a coding with the code and * system defined by the given enumerated type, AND clearing any existing * codings first. If theValue is null, existing codings are cleared and no * codings are added. * * @param theValue * The value to add, or <code>null</code> */ public void setValueAsEnum(T theValue) { Validate.notNull(myBinder, "This object does not have a binder. Constructor BoundCodeableConceptDt() should not be called!"); getCoding().clear(); if (theValue == null) { return; } getCoding().add(new CodingDt(myBinder.toSystemString(theValue), myBinder.toCodeString(theValue))); }
String[] bundleTypeValues = theRequest.getParameters().get(Constants.PARAM_BUNDLETYPE); if (bundleTypeValues != null) { bundleType = BundleTypeEnum.VALUESET_BINDER.fromCodeString(bundleTypeValues[0]);
/** * Sets the {@link #getCoding()} to contain a coding with the code and * system defined by the given enumerated type, AND clearing any existing * codings first. If theValue is null, existing codings are cleared and no * codings are added. * * @param theValue * The value to add, or <code>null</code> */ public void setValueAsEnum(T theValue) { getCoding().clear(); if (theValue == null) { return; } getCoding().add(new CodingDt(myBinder.toSystemString(theValue), myBinder.toCodeString(theValue))); }
public T getValueAsEnum() { Validate.notNull(myBinder, "This object does not have a binder. Constructor BoundCodeDt() should not be called!"); T retVal = myBinder.fromCodeString(getValue()); if (retVal == null) { // TODO: throw special exception type? } return retVal; }
/** * Sets the {@link #getCoding()} to contain a coding with the code and * system defined by the given enumerated types, AND clearing any existing * codings first. If theValue is null, existing codings are cleared and no * codings are added. * * @param theValues * The value to add, or <code>null</code> */ public void setValueAsEnum(Collection<T> theValues) { Validate.notNull(myBinder, "This object does not have a binder. Constructor BoundCodeableConceptDt() should not be called!"); getCoding().clear(); if (theValues != null) { for (T next : theValues) { getCoding().add(new CodingDt(myBinder.toSystemString(next), myBinder.toCodeString(next))); } } }
@SuppressWarnings("unchecked") private static <T extends Enum<?>> T getEnumFromMetadataOrNullIfNone(Map<ResourceMetadataKeyEnum<?>, Object> theResourceMetadata, ResourceMetadataKeyEnum<T> theKey, Class<T> theEnumType, IValueSetEnumBinder<T> theBinder) { Object retValObj = theResourceMetadata.get(theKey); if (retValObj == null) { return null; } else if (theEnumType.equals(retValObj.getClass())) { return (T) retValObj; } else if (retValObj instanceof String) { return theBinder.fromCodeString((String) retValObj); } throw new InternalErrorException("Found an object of type '" + retValObj.getClass().getCanonicalName() + "' in resource metadata for key " + theKey.name() + " - Expected " + InstantDt.class.getCanonicalName()); }
/** * Sets the {@link #getCoding()} to contain a coding with the code and * system defined by the given enumerated types, AND clearing any existing * codings first. If theValue is null, existing codings are cleared and no * codings are added. * * @param theValues * The values to add, or <code>null</code> */ public void setValueAsEnum(Collection<T> theValues) { getCoding().clear(); if (theValues != null) { for (T next : theValues) { getCoding().add(new CodingDt(myBinder.toSystemString(next), myBinder.toCodeString(next))); } } }
/** * Loops through the {@link #getCoding() codings} in this codeable concept * and returns the first bound enumerated type that matches. <b>Use * caution</b> using this method, see the return description for more * information. * * @return Returns the bound enumerated type, or <code>null</code> if none * are found. Note that a null return value doesn't neccesarily * imply that this Codeable Concept has no codes, only that it has * no codes that match the enum. */ public Set<T> getValueAsEnum() { Validate.notNull(myBinder, "This object does not have a binder. Constructor BoundCodeableConceptDt() should not be called!"); Set<T> retVal = new HashSet<T>(); for (CodingDt next : getCoding()) { if (next == null) { continue; } T nextT = myBinder.fromCodeString(defaultString(next.getCodeElement().getValue()), defaultString(next.getSystemElement().getValueAsString())); if (nextT != null) { retVal.add(nextT); } else { // TODO: throw special exception type? } } return retVal; }
private void checkBindingForSystemOps(Rest rest, Set<SystemRestfulInteractionEnum> systemOps, BaseMethodBinding<?> nextMethodBinding) { if (nextMethodBinding.getRestOperationType() != null) { String sysOpCode = nextMethodBinding.getRestOperationType().getCode(); if (sysOpCode != null) { SystemRestfulInteractionEnum sysOp = SystemRestfulInteractionEnum.VALUESET_BINDER.fromCodeString(sysOpCode); if (sysOp == null) { return; } if (systemOps.contains(sysOp) == false) { systemOps.add(sysOp); rest.addInteraction().setCode(sysOp); } } } }
/** * Loops through the {@link #getCoding() codings} in this codeable concept * and returns the first bound enumerated type that matches. <b>Use * caution</b> using this method, see the return description for more * information. * * @return Returns the bound enumerated type, or <code>null</code> if none * are found. Note that a null return value doesn't neccesarily * imply that this Codeable Concept has no codes, only that it has * no codes that match the enum. */ public Set<T> getValueAsEnum() { Set<T> retVal = new HashSet<T>(); for (CodingDt next : getCoding()) { if (next == null) { continue; } T nextT = myBinder.fromCodeString(defaultString(next.getCode().getValue()), defaultString(next.getSystem().getValueAsString())); if (nextT != null) { retVal.add(nextT); } else { // TODO: throw special exception type? } } return retVal; }
private void fillName(StructureElement elem, BaseRuntimeElementDefinition<?> nextDef, String theServerBase) { assert nextDef != null; StructureElementDefinitionType type = elem.getDefinition().addType(); String name = nextDef.getName(); DataTypeEnum fromCodeString = DataTypeEnum.VALUESET_BINDER.fromCodeString(name); if (fromCodeString == null) { throw new ConfigurationException("Unknown type: " + name); } type.setCode(fromCodeString); }
RuntimeResourceDefinition targetDef = getServerConfiguration().getFhirContext().getResourceDefinition(nextTarget); if (targetDef != null) { ResourceTypeEnum code = ResourceTypeEnum.VALUESET_BINDER.fromCodeString(targetDef.getName()); if (code != null) { param.addTarget(code);