com.fasterxml.jackson.databind.ser.VirtualBeanPropertyWriter Java Examples

The following examples show how to use com.fasterxml.jackson.databind.ser.VirtualBeanPropertyWriter. 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: JacksonHandlerInstantiatorTest.java    From log4j2-elasticsearch with Apache License 2.0 6 votes vote down vote up
@Test
public void virtualPropertyWriterInstanceReturnsSingleton() {

    // given
    VirtualProperty[] customProperties = new VirtualProperty[0];
    Log4j2Lookup valueResolver = new Log4j2Lookup(null);
    JacksonHandlerInstantiator handlerInstantiator = createTestHandlerInstantiator(customProperties, valueResolver);

    MapperConfig config = new ObjectMapper().getSerializationConfig();

    // when
    VirtualBeanPropertyWriter result1 = handlerInstantiator.virtualPropertyWriterInstance(
            config,
            VirtualPropertiesWriter.class
    );
    VirtualBeanPropertyWriter result2 = handlerInstantiator.virtualPropertyWriterInstance(
            config,
            VirtualPropertiesWriter.class
    );

    // then
    Assert.assertTrue(result1 == result2);

}
 
Example #2
Source File: TestVirtualProperties.java    From jackson-modules-base with Apache License 2.0 5 votes vote down vote up
@Override
public VirtualBeanPropertyWriter withConfig(MapperConfig<?> config,
        AnnotatedClass declaringClass, BeanPropertyDefinition propDef,
        JavaType type)
{
    return new CustomVProperty(propDef, declaringClass.getAnnotations(), type);
}
 
Example #3
Source File: SpringHandlerInstantiator.java    From spring-analysis-note with MIT License 4 votes vote down vote up
/** @since 4.3 */
@Override
public VirtualBeanPropertyWriter virtualPropertyWriterInstance(MapperConfig<?> config, Class<?> implClass) {
	return (VirtualBeanPropertyWriter) this.beanFactory.createBean(implClass);
}
 
Example #4
Source File: SpringHandlerInstantiator.java    From java-technology-stack with MIT License 4 votes vote down vote up
/** @since 4.3 */
@Override
public VirtualBeanPropertyWriter virtualPropertyWriterInstance(MapperConfig<?> config, Class<?> implClass) {
	return (VirtualBeanPropertyWriter) this.beanFactory.createBean(implClass);
}
 
Example #5
Source File: SpringHandlerInstantiator.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/** @since 4.3 */
@Override
public VirtualBeanPropertyWriter virtualPropertyWriterInstance(MapperConfig<?> config, Class<?> implClass) {
	return (VirtualBeanPropertyWriter) this.beanFactory.createBean(implClass);
}
 
Example #6
Source File: AttributePropertyWriter.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
/**
 * Since this method should typically not be called on this sub-type,
 * default implementation simply throws an {@link IllegalStateException}.
 */
@Override
public VirtualBeanPropertyWriter withConfig(MapperConfig<?> config,
        AnnotatedClass declaringClass, BeanPropertyDefinition propDef, JavaType type) {
    throw new IllegalStateException("Should not be called on this type");
}
 
Example #7
Source File: JsonAppendTest.java    From jackson-modules-base with Apache License 2.0 4 votes vote down vote up
@Override
public VirtualBeanPropertyWriter withConfig(MapperConfig<?> config, AnnotatedClass declaringClass,
        BeanPropertyDefinition propDef, JavaType type) {
    return new MyVirtualPropertyWriter(propDef, declaringClass.getAnnotations(), type);
}
 
Example #8
Source File: HandlerInstantiator.java    From lams with GNU General Public License v2.0 2 votes vote down vote up
/**
 * Method called to construct a {@link VirtualBeanPropertyWriter} instance
 * of specified type.
 *
 * @since 2.5
 */
public VirtualBeanPropertyWriter virtualPropertyWriterInstance(MapperConfig<?> config,
        Class<?> implClass) {
    return null;
}