Add constructor and javadocs

This commit is contained in:
James Agnew 2014-10-29 16:23:19 -04:00
parent da6a5d5a24
commit f2f09d03df
1 changed files with 53 additions and 20 deletions

View File

@ -26,14 +26,58 @@ import ca.uhn.fhir.model.base.composite.BaseIdentifierDt;
* #L%
*/
/**
* This class represents a restful search operation parameter for an "OR list" of tokens (in other words, a
* list which can contain one-or-more tokens, where the server should return results matching any of the tokens)
*/
public class TokenOrListParam extends BaseOrListParam<TokenParam> {
public class TokenOrListParam extends BaseOrListParam<TokenParam> {
@Override
TokenParam newInstance() {
return new TokenParam();
/**
* Create a new empty token "OR list"
*/
public TokenOrListParam() {
}
/**
* Create a new token "OR list" with a single token, or multiple tokens which have the same system value
*
* @param theSystem
* The system to use for the one token to pre-populate in this list
* @param theValues
* The values to use for the one token to pre-populate in this list
*/
public TokenOrListParam(String theSystem, String... theValues) {
for (String next : theValues) {
add(theSystem, next);
}
}
/**
* Convenience method which adds a token to this OR list using the system and code from a coding
*/
public void add(BaseCodingDt theCodingDt) {
add(new TokenParam(theCodingDt));
}
/**
* Convenience method which adds a token to this OR list using the system and value from an identifier
*/
public void add(BaseIdentifierDt theIdentifierDt) {
add(new TokenParam(theIdentifierDt));
}
/**
* Add a new token to this list
*
* @param theSystem
* The system to use for the one token to pre-populate in this list
* @param theValue
* The value to use for the one token to pre-populate in this list
*/
public void add(String theSystem, String theValue) {
add(new TokenParam(theSystem, theValue));
}
public List<BaseCodingDt> getListAsCodings() {
ArrayList<BaseCodingDt> retVal = new ArrayList<BaseCodingDt>();
for (TokenParam next : getValuesAsQueryTokens()) {
@ -45,20 +89,9 @@ public class TokenOrListParam extends BaseOrListParam<TokenParam> {
return retVal;
}
/**
* Convenience method which adds a token to this OR list
* using the system and code from a coding
*/
public void add(BaseCodingDt theCodingDt) {
add(new TokenParam(theCodingDt));
}
/**
* Convenience method which adds a token to this OR list
* using the system and value from an identifier
*/
public void add(BaseIdentifierDt theIdentifierDt) {
add(new TokenParam(theIdentifierDt));
@Override
TokenParam newInstance() {
return new TokenParam();
}
}