clarify
This commit is contained in:
parent
fb9b123c65
commit
cfe386e141
|
@ -251,6 +251,7 @@ Modifier extensions SHALL NOT change the meaning of any elements on Resource or
|
|||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Extension getExtensionByUrl(String theUrl) {
|
||||
org.apache.commons.lang3.Validate.notBlank(theUrl, "theUrl must not be blank or null");
|
||||
ArrayList<Extension> retVal = new ArrayList<Extension>();
|
||||
|
@ -271,6 +272,7 @@ Modifier extensions SHALL NOT change the meaning of any elements on Resource or
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeExtension(String theUrl) {
|
||||
for (int i = getModifierExtension().size()-1; i >= 0; i--) {
|
||||
if (theUrl.equals(getExtension().get(i).getUrl()))
|
||||
|
@ -288,6 +290,7 @@ Modifier extensions SHALL NOT change the meaning of any elements on Resource or
|
|||
* @return an unmodifiable list containing all extensions on this element which
|
||||
* match the given URL
|
||||
*/
|
||||
@Override
|
||||
public List<Extension> getExtensionsByUrl(String theUrl) {
|
||||
org.apache.commons.lang3.Validate.notBlank(theUrl, "theUrl must not be blank or null");
|
||||
ArrayList<Extension> retVal = new ArrayList<Extension>();
|
||||
|
@ -300,22 +303,6 @@ Modifier extensions SHALL NOT change the meaning of any elements on Resource or
|
|||
return java.util.Collections.unmodifiableList(retVal);
|
||||
}
|
||||
|
||||
public boolean hasExtension(String theUrl) {
|
||||
return !getExtensionsByUrl(theUrl).isEmpty();
|
||||
}
|
||||
|
||||
|
||||
public String getExtensionString(String theUrl) throws FHIRException {
|
||||
List<Extension> ext = getExtensionsByUrl(theUrl);
|
||||
if (ext.isEmpty())
|
||||
return null;
|
||||
if (ext.size() > 1)
|
||||
throw new FHIRException("Multiple matching extensions found");
|
||||
if (!ext.get(0).getValue().isPrimitive())
|
||||
throw new FHIRException("Extension could not be converted to a string");
|
||||
return ext.get(0).getValue().primitiveValue();
|
||||
}
|
||||
|
||||
// end addition
|
||||
|
||||
}
|
Loading…
Reference in New Issue