property 설정
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
package com.eactive.ext.kjb.utils;
|
||||
|
||||
import com.eactive.ext.kjb.common.KjbProperty;
|
||||
import com.eactive.ext.kjb.common.KjbPropertyValue;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
public class KjbPropertyUtil {
|
||||
public static void main(String[] args) {
|
||||
Class<?> clazz = KjbProperty.class;
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
for (Field field : clazz.getDeclaredFields()) {
|
||||
KjbPropertyValue anno = field.getAnnotation(KjbPropertyValue.class);
|
||||
|
||||
if (anno != null) {
|
||||
sb.append("insert into EMSADM.TSEAIRM24 (PRPTYGROUPNAME, PRPTYNAME, PRPTY2VAL) values ('Monitoring', ");
|
||||
|
||||
String key = anno.key();
|
||||
String defValue = anno.defaultValue();
|
||||
if (StringUtils.isEmpty(defValue)) defValue = "";
|
||||
|
||||
sb.append("'").append(key).append("', '").append(addQuote(defValue)).append("');\n");
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println(sb);
|
||||
}
|
||||
|
||||
private static String addQuote(String str) {
|
||||
return str.replace("'", "''");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user