当前位置: 首页>>代码示例>>Java>>正文


Java RuntimeChildChoiceDefinition类代码示例

本文整理汇总了Java中ca.uhn.fhir.context.RuntimeChildChoiceDefinition的典型用法代码示例。如果您正苦于以下问题:Java RuntimeChildChoiceDefinition类的具体用法?Java RuntimeChildChoiceDefinition怎么用?Java RuntimeChildChoiceDefinition使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RuntimeChildChoiceDefinition类属于ca.uhn.fhir.context包,在下文中一共展示了RuntimeChildChoiceDefinition类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: resolveChoiceProperty

import ca.uhn.fhir.context.RuntimeChildChoiceDefinition; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Override
   protected BaseRuntimeChildDefinition resolveChoiceProperty(BaseRuntimeElementCompositeDefinition definition, String path) {
       for (Object child :  definition.getChildren()) {
           if (child instanceof RuntimeChildChoiceDefinition) {
               RuntimeChildChoiceDefinition choiceDefinition = (RuntimeChildChoiceDefinition) child;
           	if(choiceDefinition.getValidChildNames().contains(path)){
           		return choiceDefinition;
           	}
           }
       }

       throw new IllegalArgumentException(String.format("Unable to resolve path %s for %s", path, definition.getName()));
   }
 
开发者ID:Discovery-Research-Network-SCCM,项目名称:FHIR-CQL-ODM-service,代码行数:15,代码来源:UsciitgFhirDataProviderHL7.java

示例2: resolveProperty

import ca.uhn.fhir.context.RuntimeChildChoiceDefinition; //导入依赖的package包/类
@Override
protected Object resolveProperty(Object target, String path) {
    if (target == null) {
        return null;
    }

    IBase base = (IBase) target;
    BaseRuntimeElementCompositeDefinition<?> definition;
    if (base instanceof IPrimitiveType) {
        return toJavaPrimitive(path.equals("value") ? ((IPrimitiveType<?>) target).getValue() : target, base);
    }
    else {
        definition = resolveRuntimeDefinition(base);
    }
    
    //BaseRuntimeChildDefinition child = definition.getChildByName(path);
    BaseRuntimeChildDefinition child = getChildByName(definition, path);
    if (child == null) {
        child = resolveChoiceProperty(definition, path);
    }

    List<IBase> values = child.getAccessor().getValues(base);

    if (values == null || values.isEmpty()) {
        return null;
    }

    if (child instanceof RuntimeChildChoiceDefinition && !child.getElementName().equalsIgnoreCase(path)) {
        if (!values.get(0).getClass().getSimpleName().equalsIgnoreCase(child.getChildByName(path).getImplementingClass().getSimpleName()))
        {
            return null;
        }
    }

    Object result = child.getMax() < 1 ? values : values.get(0);
    return toJavaPrimitive(result, result);  
}
 
开发者ID:Discovery-Research-Network-SCCM,项目名称:FHIR-CQL-ODM-service,代码行数:38,代码来源:UsciitgFhirDataProviderHL7.java

示例3: throwExceptionForUnknownChildType

import ca.uhn.fhir.context.RuntimeChildChoiceDefinition; //导入依赖的package包/类
protected void throwExceptionForUnknownChildType(BaseRuntimeChildDefinition nextChild, Class<? extends IBase> theType) {
	if (nextChild instanceof BaseRuntimeDeclaredChildDefinition) {
		StringBuilder b = new StringBuilder();
		b.append(((BaseRuntimeDeclaredChildDefinition) nextChild).getElementName());
		b.append(" has type ");
		b.append(theType.getName());
		b.append(" but this is not a valid type for this element");
		if (nextChild instanceof RuntimeChildChoiceDefinition) {
			RuntimeChildChoiceDefinition choice = (RuntimeChildChoiceDefinition) nextChild;
			b.append(" - Expected one of: " + choice.getValidChildTypes());
		}
		throw new DataFormatException(b.toString());
	}
	throw new DataFormatException(nextChild + " has no child of type " + theType);
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:16,代码来源:BaseParser.java

示例4: getValues

import ca.uhn.fhir.context.RuntimeChildChoiceDefinition; //导入依赖的package包/类
private List<Object> getValues(BaseRuntimeElementCompositeDefinition<?> theCurrentDef, Object theCurrentObj, List<String> theSubList) {
	String name = theSubList.get(0);
	BaseRuntimeChildDefinition nextDef = theCurrentDef.getChildByNameOrThrowDataFormatException(name);
	List<? extends IBase> values = nextDef.getAccessor().getValues(theCurrentObj);
	List<Object> retVal = new ArrayList<Object>();

	if (theSubList.size() == 1) {
		if (nextDef instanceof RuntimeChildChoiceDefinition) {
			for (IBase next : values) {
				if (next != null) {
					if (name.endsWith("[x]")) {
						retVal.add(next);
					} else {
						String childName = nextDef.getChildNameByDatatype(next.getClass());
						if (theSubList.get(0).equals(childName)) {
							retVal.add(next);
						}
					}
				}
			}
		} else {
			retVal.addAll(values);
		}
	} else {
		for (IBase nextElement : values) {
			BaseRuntimeElementCompositeDefinition<?> nextChildDef = (BaseRuntimeElementCompositeDefinition<?>) myContext.getElementDefinition(nextElement.getClass());
			List<?> foundValues = getValues(nextChildDef, nextElement, theSubList.subList(1, theSubList.size()));
			retVal.addAll(foundValues);
		}
	}
	return retVal;
}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:33,代码来源:FhirTerser.java


注:本文中的ca.uhn.fhir.context.RuntimeChildChoiceDefinition类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。