48.15. Java DSL 사용

다음 단계는 이 레코드 유형과 연결된 DataFormat bindy 클래스를 인스턴스화하고 Java 패키지 이름을 매개 변수로 제공하는 것입니다.

예를 들어 다음에서는 BindyCsvDataFormat 클래스를 사용하며 CSV 레코드 유형과 연결된 클래스에 해당하는 클래스를 com.acme.model 패키지 이름으로 구성하여 이 패키지에 구성된 모델 개체를 초기화합니다.For example, the following uses the class BindyCsvDataFormat (who correspond to the class associated with the CSV record type) which is configured with com.acme.model package name to initialize the model objects configured in this package.

// Camel 2.15 or older (configure by package name)
DataFormat bindy = new BindyCsvDataFormat("com.acme.model");

 
// Camel 2.16 onwards (configure by class name)
DataFormat bindy = new BindyCsvDataFormat(com.acme.model.MyModel.class);

48.15.1. 로케일 설정

Bindy는 다음과 같이 dataformat의 로캘 구성을 지원합니다. 

// Camel 2.15 or older (configure by package name)
BindyCsvDataFormat bindy = new BindyCsvDataFormat("com.acme.model");
// Camel 2.16 onwards (configure by class name)
BindyCsvDataFormat bindy = new BindyCsvDataFormat(com.acme.model.MyModel.class);

bindy.setLocale("us");

또는 플랫폼 기본 로케일을 사용하려면 로케일 이름으로 "default"를 사용합니다. Camel 2.14/2.13.3/2.12.5가 필요합니다.

// Camel 2.15 or older (configure by package name)
BindyCsvDataFormat bindy = new BindyCsvDataFormat("com.acme.model");
// Camel 2.16 onwards (configure by class name)
BindyCsvDataFormat bindy = new BindyCsvDataFormat(com.acme.model.MyModel.class);

bindy.setLocale("default");

이전 릴리스의 경우 다음과 같이 Java 코드를 사용하여 설정할 수 있습니다.

// Camel 2.15 or older (configure by package name)
BindyCsvDataFormat bindy = new BindyCsvDataFormat("com.acme.model");
// Camel 2.16 onwards (configure by class name)
BindyCsvDataFormat bindy = new BindyCsvDataFormat(com.acme.model.MyModel.class);

bindy.setLocale(Locale.getDefault().getISO3Country());