public class JsonConfigWriter extends java.lang.Object implements ApiConfigWriter
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
ANY_SCHEMA_NAME |
static java.lang.String |
MAP_SCHEMA_NAME |
| Constructor and Description |
|---|
JsonConfigWriter() |
JsonConfigWriter(java.lang.ClassLoader classLoader,
ApiConfigValidator validator) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addBeanProperties(com.fasterxml.jackson.databind.node.ObjectNode schemasNode,
com.fasterxml.jackson.databind.node.ObjectNode node,
java.lang.reflect.Type beanType,
ApiConfig apiConfig,
java.util.List<ApiParameterConfig> parameterConfigs)
Iterates over the given JavaBean class and adds the following to the given config object
(the value of "properties" of a schema object): "<name>": {"type": "<type>"}, where
"name" is the name of the JavaBean property and "type" the type of its value.
|
protected java.lang.String |
addTypeToNode(com.fasterxml.jackson.databind.node.ObjectNode schemasNode,
java.lang.reflect.Type type,
java.lang.reflect.Type enclosingType,
com.fasterxml.jackson.databind.node.ObjectNode node,
ApiConfig apiConfig,
java.util.List<ApiParameterConfig> parameterConfigs)
Adds a schema for a type into an output node.
|
java.lang.String |
getFileExtension()
The file extension associated with this writer.
|
protected java.lang.String |
getParentApiFile()
Returns the name of the file the config should extend.
|
java.util.Map<ApiKey,java.lang.String> |
writeConfig(java.lang.Iterable<? extends ApiConfig> configs)
Generate wire-formatted configuration strings for the given configs.
|
public static final java.lang.String MAP_SCHEMA_NAME
public static final java.lang.String ANY_SCHEMA_NAME
public JsonConfigWriter()
throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundExceptionpublic JsonConfigWriter(java.lang.ClassLoader classLoader,
ApiConfigValidator validator)
throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundExceptionpublic java.util.Map<ApiKey,java.lang.String> writeConfig(java.lang.Iterable<? extends ApiConfig> configs) throws ApiConfigException
ApiConfigWriterwriteConfig in interface ApiConfigWriterApiKeys to wire-formatted configuration strings.ApiConfigExceptionpublic java.lang.String getFileExtension()
ApiConfigWritergetFileExtension in interface ApiConfigWriterprotected java.lang.String getParentApiFile()
protected void addBeanProperties(com.fasterxml.jackson.databind.node.ObjectNode schemasNode,
com.fasterxml.jackson.databind.node.ObjectNode node,
java.lang.reflect.Type beanType,
ApiConfig apiConfig,
java.util.List<ApiParameterConfig> parameterConfigs)
throws ApiConfigException
ApiConfigExceptionprotected java.lang.String addTypeToNode(com.fasterxml.jackson.databind.node.ObjectNode schemasNode,
java.lang.reflect.Type type,
java.lang.reflect.Type enclosingType,
com.fasterxml.jackson.databind.node.ObjectNode node,
ApiConfig apiConfig,
java.util.List<ApiParameterConfig> parameterConfigs)
throws ApiConfigException
ApiConfigException