Search in sources :

Example 1 with ChoiceTypeSpecifier

use of org.hl7.elm_modelinfo.r1.ChoiceTypeSpecifier in project quality-measure-and-cohort-service by Alvearie.

the class ModelUtils method getChoiceTypeNames.

public static Collection<String> getChoiceTypeNames(TypeInfo typeInfo) {
    if (typeInfo != null && typeInfo.getBaseTypeSpecifier() != null && (typeInfo.getBaseTypeSpecifier() instanceof ChoiceTypeSpecifier)) {
        List<String> choiceTypes = new ArrayList<>();
        ChoiceTypeSpecifier choiceType = (ChoiceTypeSpecifier) typeInfo.getBaseTypeSpecifier();
        for (TypeSpecifier typeSpecifier : choiceType.getChoice()) {
            if (typeSpecifier instanceof NamedTypeSpecifier) {
                String typeName = ((NamedTypeSpecifier) typeSpecifier).getName();
                choiceTypes.add(typeName);
            }
        }
        return choiceTypes;
    } else {
        return Collections.emptyList();
    }
}
Also used : NamedTypeSpecifier(org.hl7.elm_modelinfo.r1.NamedTypeSpecifier) ArrayList(java.util.ArrayList) NamedTypeSpecifier(org.hl7.elm_modelinfo.r1.NamedTypeSpecifier) ChoiceTypeSpecifier(org.hl7.elm_modelinfo.r1.ChoiceTypeSpecifier) TypeSpecifier(org.hl7.elm_modelinfo.r1.TypeSpecifier) ChoiceTypeSpecifier(org.hl7.elm_modelinfo.r1.ChoiceTypeSpecifier)

Aggregations

ArrayList (java.util.ArrayList)1 ChoiceTypeSpecifier (org.hl7.elm_modelinfo.r1.ChoiceTypeSpecifier)1 NamedTypeSpecifier (org.hl7.elm_modelinfo.r1.NamedTypeSpecifier)1 TypeSpecifier (org.hl7.elm_modelinfo.r1.TypeSpecifier)1