com.fasterxml.jackson.databind.deser.DeserializerFactory Java Examples

The following examples show how to use com.fasterxml.jackson.databind.deser.DeserializerFactory. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ObjectMapperFactoryV2.java    From aws-athena-query-federation with Apache License 2.0 5 votes vote down vote up
@Override
public DeserializerFactory withConfig(DeserializerFactoryConfig config)
{
    if (_factoryConfig == config) {
        return this;
    }
    return new StrictDeserializerFactory(config);
}
 
Example #2
Source File: AWSUtil.java    From Flink-CEPplus with Apache License 2.0 5 votes vote down vote up
/**
 * Set all prefixed properties on {@link ClientConfiguration}.
 * @param config
 * @param configProps
 */
public static void setAwsClientConfigProperties(ClientConfiguration config,
												Properties configProps) {

	Map<String, Object> awsConfigProperties = new HashMap<>();
	for (Map.Entry<Object, Object> entry : configProps.entrySet()) {
		String key = (String) entry.getKey();
		if (key.startsWith(AWS_CLIENT_CONFIG_PREFIX)) {
			awsConfigProperties.put(key.substring(AWS_CLIENT_CONFIG_PREFIX.length()), entry.getValue());
		}
	}
	// Jackson does not like the following properties
	String[] ignorableProperties = {"secureRandom"};
	BeanDeserializerModifier modifier = new BeanDeserializerModifierForIgnorables(
		ClientConfiguration.class, ignorableProperties);
	DeserializerFactory factory = BeanDeserializerFactory.instance.withDeserializerModifier(
		modifier);
	ObjectMapper mapper = new ObjectMapper(null, null,
		new DefaultDeserializationContext.Impl(factory));

	JsonNode propTree = mapper.convertValue(awsConfigProperties, JsonNode.class);
	try {
		mapper.readerForUpdating(config).readValue(propTree);
	} catch (IOException ex) {
		throw new RuntimeException(ex);
	}
}
 
Example #3
Source File: AWSUtil.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Set all prefixed properties on {@link ClientConfiguration}.
 * @param config
 * @param configProps
 */
public static void setAwsClientConfigProperties(ClientConfiguration config,
												Properties configProps) {

	Map<String, Object> awsConfigProperties = new HashMap<>();
	for (Map.Entry<Object, Object> entry : configProps.entrySet()) {
		String key = (String) entry.getKey();
		if (key.startsWith(AWS_CLIENT_CONFIG_PREFIX)) {
			awsConfigProperties.put(key.substring(AWS_CLIENT_CONFIG_PREFIX.length()), entry.getValue());
		}
	}
	// Jackson does not like the following properties
	String[] ignorableProperties = {"secureRandom"};
	BeanDeserializerModifier modifier = new BeanDeserializerModifierForIgnorables(
		ClientConfiguration.class, ignorableProperties);
	DeserializerFactory factory = BeanDeserializerFactory.instance.withDeserializerModifier(
		modifier);
	ObjectMapper mapper = new ObjectMapper(null, null,
		new DefaultDeserializationContext.Impl(factory));

	JsonNode propTree = mapper.convertValue(awsConfigProperties, JsonNode.class);
	try {
		mapper.readerForUpdating(config).readValue(propTree);
	} catch (IOException ex) {
		throw new RuntimeException(ex);
	}
}
 
Example #4
Source File: AWSUtil.java    From flink with Apache License 2.0 5 votes vote down vote up
/**
 * Set all prefixed properties on {@link ClientConfiguration}.
 * @param config
 * @param configProps
 */
public static void setAwsClientConfigProperties(ClientConfiguration config,
												Properties configProps) {

	Map<String, Object> awsConfigProperties = new HashMap<>();
	for (Map.Entry<Object, Object> entry : configProps.entrySet()) {
		String key = (String) entry.getKey();
		if (key.startsWith(AWS_CLIENT_CONFIG_PREFIX)) {
			awsConfigProperties.put(key.substring(AWS_CLIENT_CONFIG_PREFIX.length()), entry.getValue());
		}
	}
	// Jackson does not like the following properties
	String[] ignorableProperties = {"secureRandom"};
	BeanDeserializerModifier modifier = new BeanDeserializerModifierForIgnorables(
		ClientConfiguration.class, ignorableProperties);
	DeserializerFactory factory = BeanDeserializerFactory.instance.withDeserializerModifier(
		modifier);
	ObjectMapper mapper = new ObjectMapper(null, null,
		new DefaultDeserializationContext.Impl(factory));

	JsonNode propTree = mapper.convertValue(awsConfigProperties, JsonNode.class);
	try {
		mapper.readerForUpdating(config).readValue(propTree);
	} catch (IOException ex) {
		throw new RuntimeException(ex);
	}
}
 
Example #5
Source File: EnumNameDeserializer.java    From metanome-algorithms with Apache License 2.0 4 votes vote down vote up
private static JsonDeserializer<?> createEnumDeserializer(DeserializationContext ctxt,
	JavaType type) throws JsonMappingException {
	BeanDescription beanDesc = ctxt.getConfig().introspect(type);
	DeserializerFactory factory = ctxt.getFactory();
	return factory.createEnumDeserializer(ctxt, type, beanDesc);
}