375.10. 교환없이ECDHEBuilder 사용
Camel 2.3에서 사용 가능
이제 Exchange 없이 org.apache.camel.builder.XPathBuilder 를 사용할 수 있습니다. 사용자 정의 xpath 평가를 수행하기 위해 도우미로 사용하려는 경우 유용합니다.
DestinationRuleBuilder 내의 많은 부분을 이동하는 데 CamelContext를 전달해야 하므로 Camel TypeECDHE에 액세스해야 하므로 CamelContext가 필요한 이유에 액세스할 수 있습니다.
예를 들어 다음과 같은 작업을 수행할 수 있습니다.
boolean matches = XPathBuilder.xpath("/foo/bar/@xyz").matches(context, "<foo><bar xyz='cheese'/></foo>"));
지정된 서술자와 일치합니다.
예를 들어 다음 세 가지 예와 같이 평가할 수도 있습니다.
String name = XPathBuilder.xpath("foo/bar").evaluate(context, "<foo><bar>cheese</bar></foo>", String.class);
Integer number = XPathBuilder.xpath("foo/bar").evaluate(context, "<foo><bar>123</bar></foo>", Integer.class);
Boolean bool = XPathBuilder.xpath("foo/bar").evaluate(context, "<foo><bar>true</bar></foo>", Boolean.class);
String 결과를 사용하여 평가하는 것은 일반적인 요구 사항이므로 조금 더 간단하게 수행할 수 있습니다.
String name = XPathBuilder.xpath("foo/bar").evaluate(context, "<foo><bar>cheese</bar></foo>");