• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java StringType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: testCreateParametersParameterComponent

import org.hl7.fhir.instance.model.StringType; //导入依赖的package包/类
@Test
public void testCreateParametersParameterComponent() {
  String[] names = { "type", "resourceUrl", "name", "_lastUpdated" };
  String[] values = { "master", "http://fhirserver.net", "Mike", "ge2016-02-16" };

  for (int i = 0; i < names.length; i++) {
    String name = names[i];
    String value = values[i];

    ParametersParameterComponent expected = new ParametersParameterComponent();
    expected.setName(name);
    StringType strTypeVal = new StringType();
    strTypeVal.setValue(value);
    expected.setValue(strTypeVal);

    ParametersParameterComponent actual = ParametersUtil.createParameter(name,
        value);
    assertNotNull(actual);
    assertEquals("name", actual.getName(), expected.getName());
    assertEquals("value", actual.getValue().toString(),
        expected.getValue().toString());
  }

}
 
开发者ID:mitre,项目名称:ptmatchadapter,代码行数:25,代码来源:ParametersUtilTest.java


示例2: testExtensionOnComposite

import org.hl7.fhir.instance.model.StringType; //导入依赖的package包/类
@Test
public void testExtensionOnComposite() throws Exception {

	Patient patient = new Patient();

	HumanName name = patient.addName();
	name.addFamily("Shmoe");
	HumanName given = name.addGiven("Joe");
	Extension ext2 = new Extension().setUrl("http://examples.com#givenext").setValue( new StringType("Hello"));
	given.getExtension().add(ext2);
	String output = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient);
	ourLog.info(output);

	String enc = ourCtx.newXmlParser().encodeResourceToString(patient);
	assertThat(enc, containsString("<name><extension url=\"http://examples.com#givenext\"><valueString value=\"Hello\"/></extension><family value=\"Shmoe\"/><given value=\"Joe\"/></name>"));

	Patient parsed = ourCtx.newXmlParser().parseResource(Patient.class, new StringReader(enc));
	assertEquals(1, parsed.getName().get(0).getExtension().size());
	Extension ext = parsed.getName().get(0).getExtension().get(0);
	assertEquals("Hello", ((IPrimitiveType<?>)ext.getValue()).getValue());

}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:23,代码来源:XmlParserTest.java


示例3: testExtensionOnPrimitive

import org.hl7.fhir.instance.model.StringType; //导入依赖的package包/类
@Test
public void testExtensionOnPrimitive() throws Exception {

	Patient patient = new Patient();

	HumanName name = patient.addName();
	StringType family = name.addFamilyElement();
	family.setValue("Shmoe");

	Extension ext2 = new Extension().setUrl("http://examples.com#givenext").setValue( new StringType("Hello"));
	family.getExtension().add(ext2);
	String output = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient);
	ourLog.info(output);

	String enc = ourCtx.newXmlParser().encodeResourceToString(patient);
	assertThat(enc, containsString("<name><family value=\"Shmoe\"><extension url=\"http://examples.com#givenext\"><valueString value=\"Hello\"/></extension></family></name>"));

	Patient parsed = ourCtx.newXmlParser().parseResource(Patient.class, new StringReader(enc));
	assertEquals(1, parsed.getName().get(0).getFamily().get(0).getExtension().size());
	Extension ext = parsed.getName().get(0).getFamily().get(0).getExtension().get(0);
	assertEquals("Hello", ((IPrimitiveType<?>)ext.getValue()).getValue());

}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:24,代码来源:XmlParserTest.java


示例4: testExtensions

import org.hl7.fhir.instance.model.StringType; //导入依赖的package包/类
@Test
public void testExtensions() throws DataFormatException {

	MyPatient patient = new MyPatient();
	patient.setPetName(new StringType("Fido"));
	patient.getImportantDates().add(new DateTimeType("2010-01-02"));
	patient.getImportantDates().add(new DateTimeType("2014-01-26T11:11:11"));

	patient.addName().addFamily("Smith");

	IParser p = ourCtx.newXmlParser();
	String str = p.encodeResourceToString(patient);

	ourLog.info(str);

	assertThat(str, StringContains.containsString("<Patient xmlns=\"http://hl7.org/fhir\">"));
	assertThat(str, StringContains.containsString("<extension url=\"http://example.com/dontuse#petname\"><valueString value=\"Fido\"/></extension>"));
	assertThat(str, StringContains.containsString("<modifierExtension url=\"http://example.com/dontuse#importantDates\"><valueDateTime value=\"2010-01-02\"/></modifierExtension>"));
	assertThat(str, StringContains.containsString("<modifierExtension url=\"http://example.com/dontuse#importantDates\"><valueDateTime value=\"2014-01-26T11:11:11\"/></modifierExtension>"));
	assertThat(str, StringContains.containsString("<name><family value=\"Smith\"/></name>"));

}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:23,代码来源:XmlParserTest.java


示例5: testEncodingNullExtension

import org.hl7.fhir.instance.model.StringType; //导入依赖的package包/类
@Test
public void testEncodingNullExtension() {
	Patient p = new Patient();
	Extension extension = new Extension().setUrl("http://foo#bar");
	p.getExtension().add(extension);
	String str = ourCtx.newJsonParser().encodeResourceToString(p);

	assertEquals("{\"resourceType\":\"Patient\"}", str);

	extension.setValue(new StringType());

	str = ourCtx.newJsonParser().encodeResourceToString(p);
	assertEquals("{\"resourceType\":\"Patient\"}", str);

	extension.setValue(new StringType(""));

	str = ourCtx.newJsonParser().encodeResourceToString(p);
	assertEquals("{\"resourceType\":\"Patient\"}", str);

}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:21,代码来源:JsonParserTest.java


示例6: testEncodeExt

import org.hl7.fhir.instance.model.StringType; //导入依赖的package包/类
@Test
public void testEncodeExt() throws Exception {

	ValueSet valueSet = new ValueSet();
	valueSet.setId("123456");

	ValueSetDefineComponent define = valueSet.getDefine();
	ConceptDefinitionComponent code = define.addConcept();
	code.setCode("someCode");
	code.setDisplay("someDisplay");
	code.addExtension().setUrl("urn:alt").setValue( new StringType("alt name"));


	String encoded = ourCtx.newJsonParser().encodeResourceToString(valueSet);
	ourLog.info(encoded);

	assertThat(encoded, (containsString("123456")));
	assertEquals(
			"{\"resourceType\":\"ValueSet\",\"id\":\"123456\",\"define\":{\"concept\":[{\"extension\":[{\"url\":\"urn:alt\",\"valueString\":\"alt name\"}],\"code\":\"someCode\",\"display\":\"someDisplay\"}]}}",
			encoded);

}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:23,代码来源:JsonParserTest.java


示例7: summariseSlicing

import org.hl7.fhir.instance.model.StringType; //导入依赖的package包/类
private String summariseSlicing(ElementDefinitionSlicingComponent slice) {
  StringBuilder b = new StringBuilder();
  boolean first = true;
  for (StringType d : slice.getDiscriminator()) {
    if (first)
      first = false;
    else
      b.append(", ");
    b.append(d);
  }
  b.append("(");
  if (slice.hasOrdered())
    b.append(slice.getOrderedElement().asStringValue());
  b.append("/");
  if (slice.hasRules())
    b.append(slice.getRules().toCode());
  b.append(")");
  if (slice.hasDescription()) {
    b.append(" \"");
    b.append(slice.getDescription());
    b.append("\"");
  }
  return b.toString();
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:25,代码来源:ProfileUtilities.java


示例8: processConstant

import org.hl7.fhir.instance.model.StringType; //导入依赖的package包/类
private Base processConstant(ExecutionContext context, String constant) throws PathEngineException {
	if (constant.equals("true")) {
		return new BooleanType(true);
	} else if (constant.equals("false")) {
		return new BooleanType(false);
   } else if (constant.equals("{}")) {
     return null;
	} else if (Utilities.isInteger(constant)) {
		return new IntegerType(constant);
   } else if (Utilities.isDecimal(constant)) {
		return new DecimalType(constant);
   } else if (constant.startsWith("\'")) {
		return new StringType(processConstantString(constant));
   } else if (constant.startsWith("%")) {
     return resolveConstant(context, constant);
   } else if (constant.startsWith("@")) {
     return processDateConstant(context.appInfo, constant.substring(1));
	} else {
		return new StringType(constant);
	}
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:22,代码来源:FHIRPathEngine.java


示例9: resolveConstant

import org.hl7.fhir.instance.model.StringType; //导入依赖的package包/类
private Base resolveConstant(ExecutionContext context, String s) throws PathEngineException {
	if (s.equals("%sct"))
     return new StringType("http://snomed.info/sct");
	else if (s.equals("%loinc"))
     return new StringType("http://loinc.org");
	else if (s.equals("%ucum"))
     return new StringType("http://unitsofmeasure.org");
   else if (s.equals("%context")) 
     return context.context;
   else if (s.equals("%resource")) {
     if (context.resource == null)
       throw new PathEngineException("Cannot use %resource in this context");
     return context.resource;
   } else if (s.equals("%us-zip"))
     return new StringType("[0-9]{5}(-[0-9]{4}){0,1}");
   else if (s.startsWith("%\"vs-"))
     return new StringType("http://hl7.org/fhir/ValueSet/"+s.substring(5, s.length()-1)+"");
   else if (s.startsWith("%\"cs-"))
     return new StringType("http://hl7.org/fhir/"+s.substring(5, s.length()-1)+"");
   else if (s.startsWith("%\"ext-"))
     return new StringType("http://hl7.org/fhir/StructureDefinition/"+s.substring(6, s.length()-1));
   else if (hostServices == null)
		throw new PathEngineException("Unknown fixed constant '"+s+"'");
	else
     return hostServices.resolveConstant(context.appInfo, s);
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:27,代码来源:FHIRPathEngine.java


示例10: funcSubstring

import org.hl7.fhir.instance.model.StringType; //导入依赖的package包/类
private List<Base> funcSubstring(ExecutionContext context, List<Base> focus, ExpressionNode exp) throws PathEngineException  {
   List<Base> result = new ArrayList<Base>();
   List<Base> n1 = execute(context, focus, exp.getParameters().get(0), true);
	int i1 = Integer.parseInt(n1.get(0).primitiveValue());
	int i2 = -1;
	if (exp.parameterCount() == 2) {
     List<Base> n2 = execute(context, focus, exp.getParameters().get(1), true);
		i2 = Integer.parseInt(n2.get(0).primitiveValue());
	}

   if (focus.size() == 1) {
     String sw = convertToString(focus.get(0));
		String s;
     if (i1 < 0 || i1 >= sw.length())
       return new ArrayList<Base>();
		if (exp.parameterCount() == 2)
       s = sw.substring(i1, Math.min(sw.length(), i1+i2));
		else
			s = sw.substring(i1);
		if (!Utilities.noString(s)) 
			result.add(new StringType(s));
	}
	return result;
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:25,代码来源:FHIRPathEngine.java


示例11: testEncodeExtensionUndeclaredNonModifier

import org.hl7.fhir.instance.model.StringType; //导入依赖的package包/类
@Test
public void testEncodeExtensionUndeclaredNonModifier() {
  Observation obs = new Observation();
  obs.setId("1");
  obs.getMeta().addProfile("http://profile");
  Extension ext = obs.addExtension();
  ext.setUrl("http://exturl").setValue(new StringType("ext_url_value"));

  obs.getCode().setText("CODE");

  IParser parser = ourCtx.newXmlParser();

  String output = parser.setPrettyPrint(true).encodeResourceToString(obs);
  ourLog.info(output);

  // @formatter:off
  assertThat(output, stringContainsInOrder("<id value=\"1\"/>", "<meta>", "<profile value=\"http://profile\"/>",
      "<extension url=\"http://exturl\">", "<valueString value=\"ext_url_value\"/>", "<text value=\"CODE\"/>"));
  assertThat(output, not(stringContainsInOrder("<url value=\"http://exturl\"/>")));
  // @formatter:on

  obs = parser.parseResource(Observation.class, output);
  assertEquals(1, obs.getExtension().size());
  assertEquals("http://exturl", obs.getExtension().get(0).getUrl());
  assertEquals("ext_url_value", ((StringType) obs.getExtension().get(0).getValue()).getValue());
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:27,代码来源:XmlParserHl7OrgDstu2Test.java


示例12: testEncodingNullExtension

import org.hl7.fhir.instance.model.StringType; //导入依赖的package包/类
@Test
public void testEncodingNullExtension() {
  Patient p = new Patient();
  Extension extension = new Extension().setUrl("http://foo#bar");
  p.getExtension().add(extension);
  String str = ourCtx.newXmlParser().encodeResourceToString(p);

  assertEquals("<Patient xmlns=\"http://hl7.org/fhir\"/>", str);

  extension.setValue(new StringType());

  str = ourCtx.newXmlParser().encodeResourceToString(p);
  assertEquals("<Patient xmlns=\"http://hl7.org/fhir\"/>", str);

  extension.setValue(new StringType(""));

  str = ourCtx.newXmlParser().encodeResourceToString(p);
  assertEquals("<Patient xmlns=\"http://hl7.org/fhir\"/>", str);

}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:21,代码来源:XmlParserHl7OrgDstu2Test.java


示例13: testExtensionOnComposite

import org.hl7.fhir.instance.model.StringType; //导入依赖的package包/类
@Test
public void testExtensionOnComposite() throws Exception {

  Patient patient = new Patient();

  HumanName name = patient.addName();
  name.addFamily("Shmoe");
  HumanName given = name.addGiven("Joe");
  Extension ext2 = new Extension().setUrl("http://examples.com#givenext").setValue(new StringType("Hello"));
  given.getExtension().add(ext2);
  String output = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient);
  ourLog.info(output);

  String enc = ourCtx.newXmlParser().encodeResourceToString(patient);
  assertThat(enc, containsString(
      "<name><extension url=\"http://examples.com#givenext\"><valueString value=\"Hello\"/></extension><family value=\"Shmoe\"/><given value=\"Joe\"/></name>"));

  Patient parsed = ourCtx.newXmlParser().parseResource(Patient.class, new StringReader(enc));
  assertEquals(1, parsed.getName().get(0).getExtension().size());
  Extension ext = parsed.getName().get(0).getExtension().get(0);
  assertEquals("Hello", ((IPrimitiveType<?>) ext.getValue()).getValue());

}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:24,代码来源:XmlParserHl7OrgDstu2Test.java


示例14: testExtensionOnPrimitive

import org.hl7.fhir.instance.model.StringType; //导入依赖的package包/类
@Test
public void testExtensionOnPrimitive() throws Exception {

  Patient patient = new Patient();

  HumanName name = patient.addName();
  StringType family = name.addFamilyElement();
  family.setValue("Shmoe");

  Extension ext2 = new Extension().setUrl("http://examples.com#givenext").setValue(new StringType("Hello"));
  family.getExtension().add(ext2);
  String output = ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(patient);
  ourLog.info(output);

  String enc = ourCtx.newXmlParser().encodeResourceToString(patient);
  assertThat(enc, containsString(
      "<name><family value=\"Shmoe\"><extension url=\"http://examples.com#givenext\"><valueString value=\"Hello\"/></extension></family></name>"));

  Patient parsed = ourCtx.newXmlParser().parseResource(Patient.class, new StringReader(enc));
  assertEquals(1, parsed.getName().get(0).getFamily().get(0).getExtension().size());
  Extension ext = parsed.getName().get(0).getFamily().get(0).getExtension().get(0);
  assertEquals("Hello", ((IPrimitiveType<?>) ext.getValue()).getValue());

}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:25,代码来源:XmlParserHl7OrgDstu2Test.java


示例15: testExtensions

import org.hl7.fhir.instance.model.StringType; //导入依赖的package包/类
@Test
public void testExtensions() throws DataFormatException {

  MyPatientHl7Org patient = new MyPatientHl7Org();
  patient.setPetName(new StringType("Fido"));
  patient.getImportantDates().add(new DateTimeType("2010-01-02"));
  patient.getImportantDates().add(new DateTimeType("2014-01-26T11:11:11"));

  patient.addName().addFamily("Smith");

  IParser p = ourCtx.newXmlParser();
  String str = p.encodeResourceToString(patient);

  ourLog.info(str);

  assertThat(str, StringContains.containsString("<Patient xmlns=\"http://hl7.org/fhir\">"));
  assertThat(str, StringContains.containsString(
      "<extension url=\"http://example.com/dontuse#petname\"><valueString value=\"Fido\"/></extension>"));
  assertThat(str, StringContains.containsString(
      "<modifierExtension url=\"http://example.com/dontuse#importantDates\"><valueDateTime value=\"2010-01-02\"/></modifierExtension>"));
  assertThat(str, StringContains.containsString(
      "<modifierExtension url=\"http://example.com/dontuse#importantDates\"><valueDateTime value=\"2014-01-26T11:11:11\"/></modifierExtension>"));
  assertThat(str, StringContains.containsString("<name><family value=\"Smith\"/></name>"));

}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:26,代码来源:XmlParserHl7OrgDstu2Test.java


示例16: createParameter

import org.hl7.fhir.instance.model.StringType; //导入依赖的package包/类
public static ParametersParameterComponent createParameter(String name, String value) {
  final ParametersParameterComponent  p = new ParametersParameterComponent();
  p.setName(name);
  StringType strTypeVal = new StringType();
  strTypeVal.setValue(value);
  p.setValue(strTypeVal);
  return p;
}
 
开发者ID:mitre,项目名称:ptmatchadapter,代码行数:9,代码来源:ParametersUtil.java


示例17: compare

import org.hl7.fhir.instance.model.StringType; //导入依赖的package包/类
@Override
public int compare(StringType st1, StringType st2) {
  int result = 0;
  
  if (st1 == null && st2 != null) {
    result = -1;
  } else if (st1 == null && st2 == null) {
    result = 0;
  } else if (st2 == null) {
    result = 1;
  } else { // neither are null
    result = st1.getValue().compareTo(st2.getValue());
  }
  return result;
}
 
开发者ID:mitre,项目名称:ptmatchadapter,代码行数:16,代码来源:StringTypeComparator.java


示例18: compare

import org.hl7.fhir.instance.model.StringType; //导入依赖的package包/类
private int compare(List<StringType> list1, List<StringType> list2) {
  int result = 0;

  if (list1.size() == 0) {
    if (list2.size() == 0) {
      result = 0;
    } else {
      result = -1;
    }
  } else { // both lists have items
    // compare the first entry; assumption is that lists are already sorted
    result = list1.get(0).getValue().compareTo(list2.get(0).getValue());
  }
  return result;
}
 
开发者ID:mitre,项目名称:ptmatchadapter,代码行数:16,代码来源:SimpleHumanNameComparator.java


示例19: testEncodeExtensionInCompositeElement

import org.hl7.fhir.instance.model.StringType; //导入依赖的package包/类
@Test
public void testEncodeExtensionInCompositeElement() {

	Conformance c = new Conformance();
	c.addRest().getSecurity().addExtension().setUrl("http://foo").setValue(new StringType("AAA"));

	String encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(c);
	ourLog.info(encoded);

	encoded = ourCtx.newJsonParser().setPrettyPrint(false).encodeResourceToString(c);
	ourLog.info(encoded);
	assertEquals(encoded, "{\"resourceType\":\"Conformance\",\"rest\":[{\"security\":{\"extension\":[{\"url\":\"http://foo\",\"valueString\":\"AAA\"}]}}]}");

}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:15,代码来源:JsonParserTest.java


示例20: testEncodeExtensionInResourceElement

import org.hl7.fhir.instance.model.StringType; //导入依赖的package包/类
@Test
public void testEncodeExtensionInResourceElement() {

	Conformance c = new Conformance();
	// c.addRest().getSecurity().addUndeclaredExtension(false, "http://foo", new StringType("AAA"));
	c.addExtension().setUrl("http://foo").setValue( new StringType("AAA"));

	String encoded = ourCtx.newJsonParser().setPrettyPrint(true).encodeResourceToString(c);
	ourLog.info(encoded);

	encoded = ourCtx.newJsonParser().setPrettyPrint(false).encodeResourceToString(c);
	ourLog.info(encoded);
	assertEquals(encoded, "{\"resourceType\":\"Conformance\",\"extension\":[{\"url\":\"http://foo\",\"valueString\":\"AAA\"}]}");

}
 
开发者ID:gajen0981,项目名称:FHIR-Server,代码行数:16,代码来源:JsonParserTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Mailer类代码示例发布时间:2022-05-22
下一篇:
Java MacroManager类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap