本文整理汇总了Java中com.jayway.jsonpath.spi.mapper.JacksonMappingProvider类的典型用法代码示例。如果您正苦于以下问题:Java JacksonMappingProvider类的具体用法?Java JacksonMappingProvider怎么用?Java JacksonMappingProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JacksonMappingProvider类属于com.jayway.jsonpath.spi.mapper包,在下文中一共展示了JacksonMappingProvider类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: before
import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider; //导入依赖的package包/类
/**
* Override to set up your specific external resource.
*/
@Override
public void before() {
saveDefaults();
Configuration.setDefaults(new Defaults() {
private final JsonProvider jsonProvider = new JacksonJsonProvider();
private final MappingProvider mappingProvider = new JacksonMappingProvider();
@Override
public JsonProvider jsonProvider() {
return jsonProvider;
}
@Override
public MappingProvider mappingProvider() {
return mappingProvider;
}
@Override
public Set<Option> options() {
return EnumSet.noneOf(Option.class);
}
});
}
示例2: init
import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider; //导入依赖的package包/类
@SuppressWarnings("WeakerAccess")
public void init(){
// jsonpath配置初始化
com.jayway.jsonpath.Configuration.setDefaults(new com.jayway.jsonpath.Configuration.Defaults() {
private final JsonProvider jsonProvider = new JacksonJsonProvider();
private final MappingProvider mappingProvider = new JacksonMappingProvider();
@Override
public JsonProvider jsonProvider() {
return jsonProvider;
}
@Override
public MappingProvider mappingProvider() {
return mappingProvider;
}
@Override
public Set<Option> options() {
return EnumSet.noneOf(Option.class);
}
});
}
示例3: setUp
import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
com.jayway.jsonpath.Configuration.setDefaults(new com.jayway.jsonpath.Configuration.Defaults() {
private final JsonProvider jsonProvider = new JacksonJsonProvider();
private final MappingProvider mappingProvider = new JacksonMappingProvider();
@Override
public JsonProvider jsonProvider() {
return jsonProvider;
}
@Override
public MappingProvider mappingProvider() {
return mappingProvider;
}
@Override
public Set<Option> options() {
return EnumSet.noneOf(Option.class);
}
});
}
示例4: setDefaults
import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider; //导入依赖的package包/类
public static void setDefaults() {
Configuration.setDefaults(new Configuration.Defaults() {
private final JsonProvider jsonProvider = new JacksonJsonProvider();
private final MappingProvider mappingProvider = new JacksonMappingProvider();
@Override
public JsonProvider jsonProvider() {
return jsonProvider;
}
@Override
public MappingProvider mappingProvider() {
return mappingProvider;
}
@Override
public Set<Option> options() {
return EnumSet.noneOf(Option.class);
}
});
}
示例5: afterPropertiesSet
import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider; //导入依赖的package包/类
@Override
public void afterPropertiesSet() throws Exception {
Configuration.setDefaults(new Configuration.Defaults() {
private final JsonProvider jsonProvider = new JacksonJsonProvider();
@Override
public JsonProvider jsonProvider() {
return jsonProvider;
}
@Override
public Set<Option> options() {
return EnumSet.noneOf(Option.class);
}
@Override
public MappingProvider mappingProvider() {
return new JacksonMappingProvider();
}
});
}
示例6: fetchSwaggerConnectorTemplateFromDeployment
import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider; //导入依赖的package包/类
private static ConnectorTemplate fetchSwaggerConnectorTemplateFromDeployment() {
final Configuration configuration = Configuration.builder()//
.jsonProvider(new JacksonJsonProvider(Json.mapper()))//
.mappingProvider(new JacksonMappingProvider(Json.mapper()))//
.build();
final List<ConnectorTemplate> templates = JsonPath.using(configuration)
.parse(AbstractSwaggerConnectorTest.class.getResourceAsStream("/io/syndesis/dao/deployment.json"))
.read("$..[?(@['id'] == 'swagger-connector-template')]", new TypeRef<List<ConnectorTemplate>>() {
// type token pattern
});
return templates.get(0);
}
示例7: ProjectingMessageConverter
import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider; //导入依赖的package包/类
/**
* Creates a new {@link ProjectingMessageConverter} using the given {@link ObjectMapper}.
*
* @param mapper must not be {@literal null}.
*/
public ProjectingMessageConverter(ObjectMapper mapper) {
Assert.notNull(mapper, "ObjectMapper must not be null!");
JacksonMappingProvider provider = new JacksonMappingProvider(mapper);
JsonProjectingMethodInterceptorFactory interceptorFactory = new JsonProjectingMethodInterceptorFactory(provider);
SpelAwareProxyProjectionFactory factory = new SpelAwareProxyProjectionFactory();
factory.registerMethodInvokerFactory(interceptorFactory);
this.projectionFactory = factory;
this.delegate = new DelegatableStringJsonMessageConverter(mapper);
}
示例8: test
import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider; //导入依赖的package包/类
@Test
public void test() throws ScriptException {
com.jayway.jsonpath.Configuration.setDefaults(new com.jayway.jsonpath.Configuration.Defaults() {
private final JsonProvider jsonProvider = new JacksonJsonProvider();
private final MappingProvider mappingProvider = new JacksonMappingProvider();
@Override
public JsonProvider jsonProvider() {
return jsonProvider;
}
@Override
public MappingProvider mappingProvider() {
return mappingProvider;
}
@Override
public Set<Option> options() {
return EnumSet.noneOf(Option.class);
}
});
// DocumentContext doc = JsonPath.parse(this.getClass().getClassLoader().getResourceAsStream("nashorn.js")); //InvalidJsonException
// TestSuit testSuit = doc.read("$", TestSuit.class);
ScriptEngineManager scriptEngineManager = new ScriptEngineManager();
ScriptEngine nashorn = scriptEngineManager.getEngineByName("nashorn");
nashorn.eval(new InputStreamReader(this.getClass().getClassLoader().getResourceAsStream("nashorn.js")));//ScriptException->ParserException
Object obj = nashorn.eval("JSON.stringify(testSuit)");
System.out.println(obj);
}
示例9: initialize
import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider; //导入依赖的package包/类
@Override
public void initialize(Bootstrap<IronTestConfiguration> bootstrap) {
bootstrap.addBundle(new AssetsBundle("/assets/app", "/ui", "index.htm", "ui"));
bootstrap.addBundle(new AssetsBundle("/META-INF/resources/webjars", "/ui/lib", null, "uilib"));
bootstrap.addBundle(jaxWsBundle);
bootstrap.addBundle(new MultiPartBundle());
bootstrap.addBundle(new ViewBundle<IronTestConfiguration>(){
@Override
public Map<String, Map<String, String>> getViewConfiguration(IronTestConfiguration config) {
return config.getViewRendererConfiguration();
}
});
Configuration.setDefaults(new Configuration.Defaults() {
private final JsonProvider jsonProvider = new JacksonJsonProvider();
private final MappingProvider mappingProvider = new JacksonMappingProvider();
@Override
public JsonProvider jsonProvider() {
return jsonProvider;
}
@Override
public MappingProvider mappingProvider() {
return mappingProvider;
}
@Override
public Set<Option> options() {
return EnumSet.noneOf(Option.class);
}
});
}
示例10: init
import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider; //导入依赖的package包/类
@Override
public Instance<String> init(BlobMetadata data, Payload payload, boolean isSegment) {
Configuration.setDefaults(new Configuration.Defaults() {
private final JsonProvider jsonProvider = new JacksonJsonProvider();
private final MappingProvider mappingProvider = new JacksonMappingProvider();
@Override
public JsonProvider jsonProvider() {
return jsonProvider;
}
@Override
public MappingProvider mappingProvider() {
return mappingProvider;
}
@Override
public Set<Option> options() {
return EnumSet.of(Option.ALWAYS_RETURN_LIST);
}
});
DocumentContext context;
try {
context = JsonPath.parse(payload.openStream());
} catch (IOException e) {
payload.release();
throw Throwables.propagate(e);
}
return new JsonSelectorInstance(context);
}
示例11: JacksonJsonDataFormat
import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider; //导入依赖的package包/类
public JacksonJsonDataFormat(String name, ObjectMapper objectMapper) {
this(name, objectMapper,
new ConfigurationBuilder()
.jsonProvider(new JacksonJsonProvider(objectMapper))
.mappingProvider(new JacksonMappingProvider(objectMapper))
.build());
}
示例12: configure
import com.jayway.jsonpath.spi.mapper.JacksonMappingProvider; //导入依赖的package包/类
/**
* UnRAVL can be configured with Spring by loading the Spring config
* classpath:/META-INF/spring/unravlApplicationContext.xml . If that has not
* been done, this method initializes Spring. Spring performs a
* component-scan for assertions, body generators, and extractors. As each
* such component is loaded, it's runtime property is {@literal @} autowired
* to a UnRAVLRuntime instance this calls the register*() methods. See
* {@link UnRAVLRequestBodyGenerator}, {@link UnRAVLAssertionPlugin}, and
* {@link UnRAVLExtractorPlugin}.
*/
public static synchronized void configure() {
if (ctx != null)
return;
// Configure Spring. Works on Unix; fails on Windows?
String[] contextXml = new String[] { "/META-INF/spring/unravlApplicationContext.xml" };
ctx = new ClassPathXmlApplicationContext(contextXml);
assert (ctx != null);
// Configure jsonPath to use Jackson
Configuration.Defaults jsonPathConfig = new Configuration.Defaults() {
private final JsonProvider jsonProvider = new JacksonJsonProvider();
private final MappingProvider mappingProvider = new JacksonMappingProvider();
@Override
public JsonProvider jsonProvider() {
return jsonProvider;
}
@Override
public MappingProvider mappingProvider() {
return mappingProvider;
}
@Override
public Set<Option> options() {
return EnumSet.noneOf(Option.class);
}
};
Configuration.setDefaults(jsonPathConfig);
}