PropertiesInUpperCase -> CustomPropertyNames

master
mjkhan21 1 year ago
parent c9f8cd9860
commit 7dff172e39

@ -2,6 +2,7 @@ package cokr.xit.foundation.data;
import java.io.InputStream; import java.io.InputStream;
import java.util.Set; import java.util.Set;
import java.util.function.UnaryOperator;
import com.fasterxml.jackson.core.JsonParser.Feature; import com.fasterxml.jackson.core.JsonParser.Feature;
import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.core.type.TypeReference;
@ -205,15 +206,26 @@ public class JSON extends AbstractComponent {
} }
} }
/** /**
* @author mjkhan * @author mjkhan
*/ */
public static class PropertiesInUpperCase extends PropertyNamingStrategy.PropertyNamingStrategyBase { public static class CustomPropertyNames extends PropertyNamingStrategy.PropertyNamingStrategyBase {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private UnaryOperator<String> customizer;
/** .
* @param customizer
* @return CustomPropertyNames
*/
public CustomPropertyNames customize(UnaryOperator<String> customizer) {
this.customizer = customizer;
return this;
}
@Override @Override
public String translate(String propertyName) { public String translate(String propertyName) {
return propertyName.toUpperCase(); return customizer != null ? customizer.apply(propertyName) : propertyName;
} }
} }
} }
Loading…
Cancel
Save