Class Questionnaire.Item.Builder
- java.lang.Object
-
- org.linuxforhealth.fhir.model.builder.AbstractBuilder<Element>
-
- org.linuxforhealth.fhir.model.type.Element.Builder
-
- org.linuxforhealth.fhir.model.type.BackboneElement.Builder
-
- org.linuxforhealth.fhir.model.resource.Questionnaire.Item.Builder
-
- Enclosing class:
- Questionnaire.Item
public static class Questionnaire.Item.Builder extends BackboneElement.Builder
-
-
Field Summary
-
Fields inherited from class org.linuxforhealth.fhir.model.type.BackboneElement.Builder
modifierExtension
-
Fields inherited from class org.linuxforhealth.fhir.model.type.Element.Builder
extension, id
-
Fields inherited from class org.linuxforhealth.fhir.model.builder.AbstractBuilder
validating
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Questionnaire.Item.Builder
answerOption(java.util.Collection<Questionnaire.Item.AnswerOption> answerOption)
One of the permitted answers for a "choice" or "open-choice" question.Questionnaire.Item.Builder
answerOption(Questionnaire.Item.AnswerOption... answerOption)
One of the permitted answers for a "choice" or "open-choice" question.Questionnaire.Item.Builder
answerValueSet(Canonical answerValueSet)
A reference to a value set containing a list of codes representing permitted answers for a "choice" or "open-choice" question.Questionnaire.Item
build()
Build theQuestionnaire.Item
Questionnaire.Item.Builder
code(java.util.Collection<Coding> code)
A terminology code that corresponds to this group or question (e.g.Questionnaire.Item.Builder
code(Coding... code)
A terminology code that corresponds to this group or question (e.g.Questionnaire.Item.Builder
definition(Uri definition)
This element is a URI that refers to an [ElementDefinition](elementdefinition.html) that provides information about this item, including information that might otherwise be included in the instance of the Questionnaire resource.Questionnaire.Item.Builder
enableBehavior(EnableWhenBehavior enableBehavior)
Controls how multiple enableWhen values are interpreted - whether all or any must be true.Questionnaire.Item.Builder
enableWhen(java.util.Collection<Questionnaire.Item.EnableWhen> enableWhen)
A constraint indicating that this item should only be enabled (displayed/allow answers to be captured) when the specified condition is true.Questionnaire.Item.Builder
enableWhen(Questionnaire.Item.EnableWhen... enableWhen)
A constraint indicating that this item should only be enabled (displayed/allow answers to be captured) when the specified condition is true.Questionnaire.Item.Builder
extension(java.util.Collection<Extension> extension)
May be used to represent additional information that is not part of the basic definition of the element.Questionnaire.Item.Builder
extension(Extension... extension)
May be used to represent additional information that is not part of the basic definition of the element.protected Questionnaire.Item.Builder
from(Questionnaire.Item item)
Questionnaire.Item.Builder
id(java.lang.String id)
Unique id for the element within a resource (for internal references).Questionnaire.Item.Builder
initial(java.util.Collection<Questionnaire.Item.Initial> initial)
One or more values that should be pre-populated in the answer when initially rendering the questionnaire for user input.Questionnaire.Item.Builder
initial(Questionnaire.Item.Initial... initial)
One or more values that should be pre-populated in the answer when initially rendering the questionnaire for user input.Questionnaire.Item.Builder
item(java.util.Collection<Questionnaire.Item> item)
Text, questions and other groups to be nested beneath a question or group.Questionnaire.Item.Builder
item(Questionnaire.Item... item)
Text, questions and other groups to be nested beneath a question or group.Questionnaire.Item.Builder
linkId(java.lang.String linkId)
Convenience method for settinglinkId
.Questionnaire.Item.Builder
linkId(String linkId)
An identifier that is unique within the Questionnaire allowing linkage to the equivalent item in a QuestionnaireResponse resource.Questionnaire.Item.Builder
maxLength(java.lang.Integer maxLength)
Convenience method for settingmaxLength
.Questionnaire.Item.Builder
maxLength(Integer maxLength)
The maximum number of characters that are permitted in the answer to be considered a "valid" QuestionnaireResponse.Questionnaire.Item.Builder
modifierExtension(java.util.Collection<Extension> modifierExtension)
May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants.Questionnaire.Item.Builder
modifierExtension(Extension... modifierExtension)
May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants.Questionnaire.Item.Builder
prefix(java.lang.String prefix)
Convenience method for settingprefix
.Questionnaire.Item.Builder
prefix(String prefix)
A short label for a particular group, question or set of display text within the questionnaire used for reference by the individual completing the questionnaire.Questionnaire.Item.Builder
readOnly(java.lang.Boolean readOnly)
Convenience method for settingreadOnly
.Questionnaire.Item.Builder
readOnly(Boolean readOnly)
An indication, when true, that the value cannot be changed by a human respondent to the Questionnaire.Questionnaire.Item.Builder
repeats(java.lang.Boolean repeats)
Convenience method for settingrepeats
.Questionnaire.Item.Builder
repeats(Boolean repeats)
An indication, if true, that the item may occur multiple times in the response, collecting multiple answers for questions or multiple sets of answers for groups.Questionnaire.Item.Builder
required(java.lang.Boolean required)
Convenience method for settingrequired
.Questionnaire.Item.Builder
required(Boolean required)
An indication, if true, that the item must be present in a "completed" QuestionnaireResponse.Questionnaire.Item.Builder
text(java.lang.String text)
Convenience method for settingtext
.Questionnaire.Item.Builder
text(String text)
The name of a section, the text of a question or text content for a display item.Questionnaire.Item.Builder
type(QuestionnaireItemType type)
The type of questionnaire item this is - whether text for display, a grouping of other items or a particular type of data to be captured (string, integer, coded choice, etc.).protected void
validate(Questionnaire.Item item)
-
Methods inherited from class org.linuxforhealth.fhir.model.type.BackboneElement.Builder
from, validate
-
Methods inherited from class org.linuxforhealth.fhir.model.type.Element.Builder
from, validate
-
Methods inherited from class org.linuxforhealth.fhir.model.builder.AbstractBuilder
isValidating, setValidating
-
-
-
-
Method Detail
-
id
public Questionnaire.Item.Builder id(java.lang.String id)
Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.- Overrides:
id
in classBackboneElement.Builder
- Parameters:
id
- Unique id for inter-element referencing- Returns:
- A reference to this Builder instance
-
extension
public Questionnaire.Item.Builder extension(Extension... extension)
May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.Adds new element(s) to the existing list. If any of the elements are null, calling
build()
will fail.- Overrides:
extension
in classBackboneElement.Builder
- Parameters:
extension
- Additional content defined by implementations- Returns:
- A reference to this Builder instance
-
extension
public Questionnaire.Item.Builder extension(java.util.Collection<Extension> extension)
May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.Replaces the existing list with a new one containing elements from the Collection. If any of the elements are null, calling
build()
will fail.- Overrides:
extension
in classBackboneElement.Builder
- Parameters:
extension
- Additional content defined by implementations- Returns:
- A reference to this Builder instance
- Throws:
java.lang.NullPointerException
- If the passed collection is null
-
modifierExtension
public Questionnaire.Item.Builder modifierExtension(Extension... modifierExtension)
May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).
Adds new element(s) to the existing list. If any of the elements are null, calling
build()
will fail.- Overrides:
modifierExtension
in classBackboneElement.Builder
- Parameters:
modifierExtension
- Extensions that cannot be ignored even if unrecognized- Returns:
- A reference to this Builder instance
-
modifierExtension
public Questionnaire.Item.Builder modifierExtension(java.util.Collection<Extension> modifierExtension)
May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).
Replaces the existing list with a new one containing elements from the Collection. If any of the elements are null, calling
build()
will fail.- Overrides:
modifierExtension
in classBackboneElement.Builder
- Parameters:
modifierExtension
- Extensions that cannot be ignored even if unrecognized- Returns:
- A reference to this Builder instance
- Throws:
java.lang.NullPointerException
- If the passed collection is null
-
linkId
public Questionnaire.Item.Builder linkId(java.lang.String linkId)
Convenience method for settinglinkId
.This element is required.
- Parameters:
linkId
- Unique id for item in questionnaire- Returns:
- A reference to this Builder instance
- See Also:
linkId(org.linuxforhealth.fhir.model.type.String)
-
linkId
public Questionnaire.Item.Builder linkId(String linkId)
An identifier that is unique within the Questionnaire allowing linkage to the equivalent item in a QuestionnaireResponse resource.This element is required.
- Parameters:
linkId
- Unique id for item in questionnaire- Returns:
- A reference to this Builder instance
-
definition
public Questionnaire.Item.Builder definition(Uri definition)
This element is a URI that refers to an [ElementDefinition](elementdefinition.html) that provides information about this item, including information that might otherwise be included in the instance of the Questionnaire resource. A detailed description of the construction of the URI is shown in Comments, below. If this element is present then the following element values MAY be derived from the Element Definition if the corresponding elements of this Questionnaire resource instance have no value:* code (ElementDefinition.code)
* type (ElementDefinition.type)
* required (ElementDefinition.min)
* repeats (ElementDefinition.max)
* maxLength (ElementDefinition.maxLength)
* answerValueSet (ElementDefinition.binding)
* options (ElementDefinition.binding).
- Parameters:
definition
- ElementDefinition - details for the item- Returns:
- A reference to this Builder instance
-
code
public Questionnaire.Item.Builder code(Coding... code)
A terminology code that corresponds to this group or question (e.g. a code from LOINC, which defines many questions and answers).Adds new element(s) to the existing list. If any of the elements are null, calling
build()
will fail.- Parameters:
code
- Corresponding concept for this item in a terminology- Returns:
- A reference to this Builder instance
-
code
public Questionnaire.Item.Builder code(java.util.Collection<Coding> code)
A terminology code that corresponds to this group or question (e.g. a code from LOINC, which defines many questions and answers).Replaces the existing list with a new one containing elements from the Collection. If any of the elements are null, calling
build()
will fail.- Parameters:
code
- Corresponding concept for this item in a terminology- Returns:
- A reference to this Builder instance
- Throws:
java.lang.NullPointerException
- If the passed collection is null
-
prefix
public Questionnaire.Item.Builder prefix(java.lang.String prefix)
Convenience method for settingprefix
.- Parameters:
prefix
- E.g. "1(a)", "2.5.3"- Returns:
- A reference to this Builder instance
- See Also:
prefix(org.linuxforhealth.fhir.model.type.String)
-
prefix
public Questionnaire.Item.Builder prefix(String prefix)
A short label for a particular group, question or set of display text within the questionnaire used for reference by the individual completing the questionnaire.- Parameters:
prefix
- E.g. "1(a)", "2.5.3"- Returns:
- A reference to this Builder instance
-
text
public Questionnaire.Item.Builder text(java.lang.String text)
Convenience method for settingtext
.- Parameters:
text
- Primary text for the item- Returns:
- A reference to this Builder instance
- See Also:
text(org.linuxforhealth.fhir.model.type.String)
-
text
public Questionnaire.Item.Builder text(String text)
The name of a section, the text of a question or text content for a display item.- Parameters:
text
- Primary text for the item- Returns:
- A reference to this Builder instance
-
type
public Questionnaire.Item.Builder type(QuestionnaireItemType type)
The type of questionnaire item this is - whether text for display, a grouping of other items or a particular type of data to be captured (string, integer, coded choice, etc.).This element is required.
- Parameters:
type
- group | display | boolean | decimal | integer | date | dateTime +- Returns:
- A reference to this Builder instance
-
enableWhen
public Questionnaire.Item.Builder enableWhen(Questionnaire.Item.EnableWhen... enableWhen)
A constraint indicating that this item should only be enabled (displayed/allow answers to be captured) when the specified condition is true.Adds new element(s) to the existing list. If any of the elements are null, calling
build()
will fail.- Parameters:
enableWhen
- Only allow data when- Returns:
- A reference to this Builder instance
-
enableWhen
public Questionnaire.Item.Builder enableWhen(java.util.Collection<Questionnaire.Item.EnableWhen> enableWhen)
A constraint indicating that this item should only be enabled (displayed/allow answers to be captured) when the specified condition is true.Replaces the existing list with a new one containing elements from the Collection. If any of the elements are null, calling
build()
will fail.- Parameters:
enableWhen
- Only allow data when- Returns:
- A reference to this Builder instance
- Throws:
java.lang.NullPointerException
- If the passed collection is null
-
enableBehavior
public Questionnaire.Item.Builder enableBehavior(EnableWhenBehavior enableBehavior)
Controls how multiple enableWhen values are interpreted - whether all or any must be true.- Parameters:
enableBehavior
- all | any- Returns:
- A reference to this Builder instance
-
required
public Questionnaire.Item.Builder required(java.lang.Boolean required)
Convenience method for settingrequired
.- Parameters:
required
- Whether the item must be included in data results- Returns:
- A reference to this Builder instance
- See Also:
required(org.linuxforhealth.fhir.model.type.Boolean)
-
required
public Questionnaire.Item.Builder required(Boolean required)
An indication, if true, that the item must be present in a "completed" QuestionnaireResponse. If false, the item may be skipped when answering the questionnaire.- Parameters:
required
- Whether the item must be included in data results- Returns:
- A reference to this Builder instance
-
repeats
public Questionnaire.Item.Builder repeats(java.lang.Boolean repeats)
Convenience method for settingrepeats
.- Parameters:
repeats
- Whether the item may repeat- Returns:
- A reference to this Builder instance
- See Also:
repeats(org.linuxforhealth.fhir.model.type.Boolean)
-
repeats
public Questionnaire.Item.Builder repeats(Boolean repeats)
An indication, if true, that the item may occur multiple times in the response, collecting multiple answers for questions or multiple sets of answers for groups.- Parameters:
repeats
- Whether the item may repeat- Returns:
- A reference to this Builder instance
-
readOnly
public Questionnaire.Item.Builder readOnly(java.lang.Boolean readOnly)
Convenience method for settingreadOnly
.- Parameters:
readOnly
- Don't allow human editing- Returns:
- A reference to this Builder instance
- See Also:
readOnly(org.linuxforhealth.fhir.model.type.Boolean)
-
readOnly
public Questionnaire.Item.Builder readOnly(Boolean readOnly)
An indication, when true, that the value cannot be changed by a human respondent to the Questionnaire.- Parameters:
readOnly
- Don't allow human editing- Returns:
- A reference to this Builder instance
-
maxLength
public Questionnaire.Item.Builder maxLength(java.lang.Integer maxLength)
Convenience method for settingmaxLength
.- Parameters:
maxLength
- No more than this many characters- Returns:
- A reference to this Builder instance
- See Also:
maxLength(org.linuxforhealth.fhir.model.type.Integer)
-
maxLength
public Questionnaire.Item.Builder maxLength(Integer maxLength)
The maximum number of characters that are permitted in the answer to be considered a "valid" QuestionnaireResponse.- Parameters:
maxLength
- No more than this many characters- Returns:
- A reference to this Builder instance
-
answerValueSet
public Questionnaire.Item.Builder answerValueSet(Canonical answerValueSet)
A reference to a value set containing a list of codes representing permitted answers for a "choice" or "open-choice" question.- Parameters:
answerValueSet
- Valueset containing permitted answers- Returns:
- A reference to this Builder instance
-
answerOption
public Questionnaire.Item.Builder answerOption(Questionnaire.Item.AnswerOption... answerOption)
One of the permitted answers for a "choice" or "open-choice" question.Adds new element(s) to the existing list. If any of the elements are null, calling
build()
will fail.- Parameters:
answerOption
- Permitted answer- Returns:
- A reference to this Builder instance
-
answerOption
public Questionnaire.Item.Builder answerOption(java.util.Collection<Questionnaire.Item.AnswerOption> answerOption)
One of the permitted answers for a "choice" or "open-choice" question.Replaces the existing list with a new one containing elements from the Collection. If any of the elements are null, calling
build()
will fail.- Parameters:
answerOption
- Permitted answer- Returns:
- A reference to this Builder instance
- Throws:
java.lang.NullPointerException
- If the passed collection is null
-
initial
public Questionnaire.Item.Builder initial(Questionnaire.Item.Initial... initial)
One or more values that should be pre-populated in the answer when initially rendering the questionnaire for user input.Adds new element(s) to the existing list. If any of the elements are null, calling
build()
will fail.- Parameters:
initial
- Initial value(s) when item is first rendered- Returns:
- A reference to this Builder instance
-
initial
public Questionnaire.Item.Builder initial(java.util.Collection<Questionnaire.Item.Initial> initial)
One or more values that should be pre-populated in the answer when initially rendering the questionnaire for user input.Replaces the existing list with a new one containing elements from the Collection. If any of the elements are null, calling
build()
will fail.- Parameters:
initial
- Initial value(s) when item is first rendered- Returns:
- A reference to this Builder instance
- Throws:
java.lang.NullPointerException
- If the passed collection is null
-
item
public Questionnaire.Item.Builder item(Questionnaire.Item... item)
Text, questions and other groups to be nested beneath a question or group.Adds new element(s) to the existing list. If any of the elements are null, calling
build()
will fail.- Parameters:
item
- Nested questionnaire items- Returns:
- A reference to this Builder instance
-
item
public Questionnaire.Item.Builder item(java.util.Collection<Questionnaire.Item> item)
Text, questions and other groups to be nested beneath a question or group.Replaces the existing list with a new one containing elements from the Collection. If any of the elements are null, calling
build()
will fail.- Parameters:
item
- Nested questionnaire items- Returns:
- A reference to this Builder instance
- Throws:
java.lang.NullPointerException
- If the passed collection is null
-
build
public Questionnaire.Item build()
- Specified by:
build
in interfaceBuilder<Element>
- Specified by:
build
in classBackboneElement.Builder
- Returns:
- An immutable object of type
Questionnaire.Item
- Throws:
java.lang.IllegalStateException
- if the current state cannot be built into a valid Item per the base specification
-
validate
protected void validate(Questionnaire.Item item)
-
from
protected Questionnaire.Item.Builder from(Questionnaire.Item item)
-
-