|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Configurator
Configurator의 인터페이스이다. Configurator는 구성 파일에 설정된 값과 시스템 프로퍼티에 설정된 값을 제공한다. 요청된 key 값에 대하여 시스템 프로퍼티에 값이 존재할 경우 그 값을 우선적으로 반환하며, 시스템 프로퍼티에 값이 없을 경우에는 구성 파일에 설정된 값을 반환한다.
Configurator의 구현 클래스는 Configurator 객체가 생성될 때 시스템 프로퍼티의 값들을 복사하여 저장해 놓아 나중에 시스템 프로퍼티의 값이 바뀌어도 Configurator는 원래의 값을 반환하도록 구현해야 한다.
위 Interface을 이용한 구성 화일의 로드하는 예제는 아래와 같다.
Configurator configurator = ConfiguratorFactory.getInstance().getConfigurator();
| Method Summary | |
|---|---|
void |
clear()
설정 정보 clear |
void |
doConfigure(InputStream stream)
ConfiguratorFactory로 부터 파라메터로 받은 configuration file의 InputStream을 읽어서 메모리에 적재하는 초기화 로직. |
boolean |
getBoolean(String key)
시스템 프로퍼티 또는 Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 boolean형(primitive)으로 리턴한다. |
boolean |
getBoolean(String key,
boolean defaultValue)
시스템 프로퍼티 또는 Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 boolean형(primitive)으로 리턴한다. |
int |
getInt(String key)
<시스템 프로퍼티 또는 strong>Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 int형(primitive)으로 리턴한다. |
int |
getInt(String key,
int defaultValue)
시스템 프로퍼티 또는 Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 int형(primitive)으로 리턴한다. |
Set<Object> |
getKeySet()
Configuration으로 정의된 항목들의 Key 집합을 리턴한다. |
long |
getLong(String key)
시스템 프로퍼티 또는 Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 long형(primitive)으로 리턴한다. |
long |
getLong(String key,
long defaultValue)
시스템 프로퍼티 또는 Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 long형(primitive)으로 리턴한다. |
String |
getPath(String key,
String defaultPath)
시스템 프로퍼티 또는 Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 파일 경로 문자열로 리턴한다. |
String |
getString(String key)
시스템 프로퍼티 또는 Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 String형으로 리턴한다. |
String |
getString(String key,
String defaultValue)
시스템 프로퍼티 또는 Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 String형으로 리턴한다. |
void |
validate(ConfigurationValidator validator)
주어진 ConfigurationValidator 사용하여 구성정보를 검증한다. |
| Method Detail |
|---|
void doConfigure(InputStream stream)
throws ConfiguratorException
ConfiguratorFactory로 부터 파라메터로 받은 configuration file의
InputStream을 읽어서 메모리에 적재하는 초기화 로직.
stream - configuration file의 stream 오브젝트.
ConfiguratorException - 읽혀지는 InputStream의 IOException 발생시.
String getString(String key)
throws ConfiguratorException
시스템 프로퍼티 또는 Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 String형으로 리턴한다.
key - 원하고자하는 key값
ConfiguratorException - key값이 configuration file에 존재하지 않을 경우 발생
String getString(String key,
String defaultValue)
시스템 프로퍼티 또는 Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 String형으로 리턴한다.
key - 원하고자하는 key값defaultValue - 값이 없을 경우 default값
int getInt(String key)
throws ConfiguratorException
<시스템 프로퍼티 또는 strong>Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 int형(primitive)으로 리턴한다.
key - 원하고자하는 key값.
ConfiguratorException - value값이 int형으로 가져올 수 없는 데이터 형 일 경우 : NumberFormatExcetion.
int getInt(String key,
int defaultValue)
시스템 프로퍼티 또는 Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 int형(primitive)으로 리턴한다.
key - 원하고자하는 key값.defaultValue - 값이 없을 경우 default값
ConfiguratorException - value값이 int형으로 가져올 수 없는 데이터 형 일 경우 : NumberFormatExcetion.
boolean getBoolean(String key)
throws ConfiguratorException
시스템 프로퍼티 또는 Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 boolean형(primitive)으로 리턴한다.
key - 원하고자하는 key값.
ConfiguratorException - value값이 boolean형으로 가져올 수 없는 데이터 형 일 경우.
boolean getBoolean(String key,
boolean defaultValue)
시스템 프로퍼티 또는 Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 boolean형(primitive)으로 리턴한다.
key - 원하고자하는 key값.defaultValue - 값이 없을 경우 default값
ConfiguratorException - value값이 boolean형으로 가져올 수 없는 데이터 형 일 경우.
long getLong(String key)
throws ConfiguratorException
시스템 프로퍼티 또는 Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 long형(primitive)으로 리턴한다.
key - 원하고자하는 key값.
ConfiguratorException - value값이 long형으로 가져올 수 없는 데이터 형 일 경우.
long getLong(String key,
long defaultValue)
시스템 프로퍼티 또는 Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 long형(primitive)으로 리턴한다.
key - 원하고자하는 key값.defaultValue - 값이 없을 경우 default값
ConfiguratorException - value값이 long형으로 가져올 수 없는 데이터 형 일 경우.
String getPath(String key,
String defaultPath)
시스템 프로퍼티 또는 Configurator에 의해 메모리에 로드된 configuration file의 원하고자 하는 특정 key를 인자로 하여 해당 Value를 파일 경로 문자열로 리턴한다. 문자열에 포함된 디렉토리 분리 문자를 OS에 맞는 문자로 통일시킨다.
key - 원하고자하는 key값defaultValue - 값이 없을 경우 default값
Set<Object> getKeySet()
Configuration으로 정의된 항목들의 Key 집합을 리턴한다.
void clear()
void validate(ConfigurationValidator validator)
throws ConfiguratorException
ConfiguratorException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||