diff --git a/src/main/java/cokr/xit/foundation/data/JSON.java b/src/main/java/cokr/xit/foundation/data/JSON.java index d5cec8f..7ac8ffa 100644 --- a/src/main/java/cokr/xit/foundation/data/JSON.java +++ b/src/main/java/cokr/xit/foundation/data/JSON.java @@ -2,6 +2,7 @@ package cokr.xit.foundation.data; import java.io.InputStream; import java.util.Set; +import java.util.function.UnaryOperator; import com.fasterxml.jackson.core.JsonParser.Feature; import com.fasterxml.jackson.core.type.TypeReference; @@ -205,15 +206,26 @@ public class JSON extends AbstractComponent { } } - /**대문자 이름으로 된 프로퍼티를 읽고 쓸 때 사용 + /**프로퍼티 이름 커스터마이져 * @author mjkhan */ - public static class PropertiesInUpperCase extends PropertyNamingStrategy.PropertyNamingStrategyBase { + public static class CustomPropertyNames extends PropertyNamingStrategy.PropertyNamingStrategyBase { private static final long serialVersionUID = 1L; + private UnaryOperator customizer; + + /**프로퍼티 이름을 반환하는 커스터마이져를 설정한다. + * @param customizer 프로퍼티 이름을 반환하는 커스터마이져 + * @return 현재 CustomPropertyNames + */ + public CustomPropertyNames customize(UnaryOperator customizer) { + this.customizer = customizer; + return this; + } + @Override public String translate(String propertyName) { - return propertyName.toUpperCase(); + return customizer != null ? customizer.apply(propertyName) : propertyName; } } } \ No newline at end of file