当前位置: 首页>>代码示例>>Java>>正文


Java BeanSerializerBase类代码示例

本文整理汇总了Java中com.fasterxml.jackson.databind.ser.std.BeanSerializerBase的典型用法代码示例。如果您正苦于以下问题:Java BeanSerializerBase类的具体用法?Java BeanSerializerBase怎么用?Java BeanSerializerBase使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BeanSerializerBase类属于com.fasterxml.jackson.databind.ser.std包,在下文中一共展示了BeanSerializerBase类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: asArraySerializer

import com.fasterxml.jackson.databind.ser.std.BeanSerializerBase; //导入依赖的package包/类
/**
 * Copied from the underlying Jackson implementation of BeanSerializer.
 *
 * Implementation has to check whether as-array serialization
 * is possible reliably; if (and only if) so, will construct
 * a {@link BeanAsArraySerializer}, otherwise will return this
 * serializer as is.
 */
@Override
protected BeanSerializerBase asArraySerializer() {
    /* Can not:
     *
     * - have Object Id (may be allowed in future)
     * - have "any getter"
     * - have per-property filters
     */
    if ((_objectIdWriter == null)
            && (_anyGetterWriter == null)
            && (_propertyFilterId == null)
            ) {
        return new BeanAsArraySerializer(this);
    }
    // already is one, so:
    return this;
}
 
开发者ID:joyent,项目名称:java-triton,代码行数:26,代码来源:FlatteningModifySerializer.java

示例2: setupModule

import com.fasterxml.jackson.databind.ser.std.BeanSerializerBase; //导入依赖的package包/类
@Override
public void setupModule(final SetupContext context) {
    super.setupModule(context);

    context.addBeanSerializerModifier(new BeanSerializerModifier() {

        public JsonSerializer<?> modifySerializer(
                final SerializationConfig config,
                final BeanDescription beanDesc,
                final JsonSerializer<?> serializer) {
            Class<?> valueClass = beanDesc.getType().getRawClass();

            if (serializer instanceof BeanSerializerBase
                    && MODIFIABLE_CLASSES.contains(valueClass)) {
                return new FlatteningModifySerializer(
                        (BeanSerializerBase) serializer);
            }

            return serializer;
        }
    });
}
 
开发者ID:joyent,项目名称:java-triton,代码行数:23,代码来源:PostprocessModificationModule.java

示例3: setupModule

import com.fasterxml.jackson.databind.ser.std.BeanSerializerBase; //导入依赖的package包/类
@Override
public void setupModule(SetupContext context) {
    super.setupModule(context);

    context.addBeanSerializerModifier(new BeanSerializerModifier() {

        public JsonSerializer<?> modifySerializer(
                SerializationConfig config,
                BeanDescription beanDesc,
                JsonSerializer<?> serializer) {
            if (serializer instanceof BeanSerializerBase) {
                return new DictionaryObjectSerializer(
                        (BeanSerializerBase) serializer);
            }
            return serializer;
        }
    });
}
 
开发者ID:jhendess,项目名称:metadict,代码行数:19,代码来源:MetadictJacksonModule.java

示例4: asArraySerializer

import com.fasterxml.jackson.databind.ser.std.BeanSerializerBase; //导入依赖的package包/类
@Override
protected BeanSerializerBase asArraySerializer() {
/* Can not:
 *
 * - have Object Id (may be allowed in future)
 * - have any getter
 *
 */
    if ((_objectIdWriter == null)
            && (_anyGetterWriter == null)
            && (_propertyFilterId == null)
            ) {
        return new BeanAsArraySerializer(this);
    }
    // already is one, so:
    return this;
}
 
开发者ID:dschulten,项目名称:hydra-java,代码行数:18,代码来源:JacksonHydraSerializer.java

示例5: setupModule

import com.fasterxml.jackson.databind.ser.std.BeanSerializerBase; //导入依赖的package包/类
public void setupModule(SetupContext context) {
    super.setupModule(context);

    context.addBeanSerializerModifier(new BeanSerializerModifier() {

        public JsonSerializer<?> modifySerializer(
                SerializationConfig config,
                BeanDescription beanDesc,
                JsonSerializer<?> serializer) {

            if (serializer instanceof BeanSerializerBase) {
                JacksonHydraSerializer jacksonHydraSerializer = new JacksonHydraSerializer(
                        (BeanSerializerBase) serializer, proxyUnwrapper);
                return jacksonHydraSerializer;
            } else {
                return serializer;
            }
        }
    });
}
 
开发者ID:dschulten,项目名称:hydra-java,代码行数:21,代码来源:JacksonHydraModule.java

示例6: asArraySerializer

import com.fasterxml.jackson.databind.ser.std.BeanSerializerBase; //导入依赖的package包/类
/**
 * Implementation has to check whether as-array serialization
 * is possible reliably; if (and only if) so, will construct
 * a {@link BeanAsArraySerializer}, otherwise will return this
 * serializer as is.
 */
@Override
protected BeanSerializerBase asArraySerializer()
{
    /* Can not:
     * 
     * - have Object Id (may be allowed in future)
     * - have any getter
     * 
     */
    if ((_objectIdWriter == null)
            && (_anyGetterWriter == null)
            && (_propertyFilterId == null)
            ) {
        return new BeanAsArraySerializer(this);
    }
    // already is one, so:
    return this;
}
 
开发者ID:joyplus,项目名称:joyplus-tv,代码行数:25,代码来源:BeanSerializer.java

示例7: modifySerializer

import com.fasterxml.jackson.databind.ser.std.BeanSerializerBase; //导入依赖的package包/类
@Override
public JsonSerializer<?> modifySerializer(SerializationConfig config, BeanDescription beanDesc, JsonSerializer<?> serializer) {
	if (serializer instanceof BeanSerializerBase) {
		return new ESBeanSerializer((BeanSerializerBase) serializer);
	}
	
	return serializer;
}
 
开发者ID:aureliano,项目名称:evt-bridge,代码行数:9,代码来源:ESBeanSerializerModifier.java

示例8: modifySerializer

import com.fasterxml.jackson.databind.ser.std.BeanSerializerBase; //导入依赖的package包/类
@Override
public JsonSerializer<?> modifySerializer(SerializationConfig config, BeanDescription beanDesc, JsonSerializer<?> serializer) {
    if(AnnotationsUtils.isAnnotationPresent(beanDesc.getBeanClass(), JsonldResource.class) && serializer instanceof BeanSerializerBase){
        return new JsonldResourceSerializer((BeanSerializerBase) serializer);
    }
    return serializer;
}
 
开发者ID:io-informatics,项目名称:jackson-jsonld,代码行数:8,代码来源:JsonldResourceSerializerModifier.java

示例9: asArraySerializer

import com.fasterxml.jackson.databind.ser.std.BeanSerializerBase; //导入依赖的package包/类
/**
 * See {@see BeanSerializer#asArraySerializer} implementation.
 */
@Override
protected BeanSerializerBase asArraySerializer() {
    if ((this._objectIdWriter == null)
            && (this._anyGetterWriter == null)
            && (this._propertyFilterId == null)
            ) {
        return new BeanAsArraySerializer(this);
    }
    return this;
}
 
开发者ID:jhendess,项目名称:metadict,代码行数:14,代码来源:DictionaryObjectSerializer.java

示例10: setUp

import com.fasterxml.jackson.databind.ser.std.BeanSerializerBase; //导入依赖的package包/类
@Before
public void setUp() {
    mapper = new ObjectMapper();
    // see https://github.com/json-ld/json-ld.org/issues/76
    mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);

    mapper.registerModule(new SimpleModule() {

        public void setupModule(SetupContext context) {
            super.setupModule(context);

            context.addBeanSerializerModifier(new BeanSerializerModifier() {

                public JsonSerializer<?> modifySerializer(
                        SerializationConfig config,
                        BeanDescription beanDesc,
                        JsonSerializer<?> serializer) {

                    if (serializer instanceof BeanSerializerBase) {
                        return new JacksonHydraSerializer(
                                (BeanSerializerBase) serializer);
                    } else {
                        return serializer;
                    }
                }
            });
        }
    });

}
 
开发者ID:dschulten,项目名称:hydra-java,代码行数:31,代码来源:JacksonHydraSerializerTest.java

示例11: withObjectIdWriter

import com.fasterxml.jackson.databind.ser.std.BeanSerializerBase; //导入依赖的package包/类
@Override
public BeanSerializerBase withObjectIdWriter(ObjectIdWriter objectIdWriter) {
    return new ResourceDecoratorSerializer<>(
            this,
            objectIdWriter,
            resourceContext,
            resourceDecorator
    );
}
 
开发者ID:nemerosa,项目名称:ontrack,代码行数:10,代码来源:ResourceDecoratorSerializer.java

示例12: withIgnorals

import com.fasterxml.jackson.databind.ser.std.BeanSerializerBase; //导入依赖的package包/类
@Override
protected BeanSerializerBase withIgnorals(Set<String> toIgnore) {
    return new ResourceDecoratorSerializer<>(
            this,
            toIgnore,
            resourceContext,
            resourceDecorator
    );
}
 
开发者ID:nemerosa,项目名称:ontrack,代码行数:10,代码来源:ResourceDecoratorSerializer.java

示例13: modifySerializer

import com.fasterxml.jackson.databind.ser.std.BeanSerializerBase; //导入依赖的package包/类
public JsonSerializer<?> modifySerializer(
        SerializationConfig config,
        BeanDescription beanDesc,
        JsonSerializer<?> serializer) {
    if (resourceDecorator.appliesFor(beanDesc.getBeanClass())) {
        return new ResourceDecoratorSerializer<>((BeanSerializerBase) serializer, resourceDecorator, resourceContext);
    } else {
        return super.modifySerializer(config, beanDesc, serializer);
    }
}
 
开发者ID:nemerosa,项目名称:ontrack,代码行数:11,代码来源:ResourceSerializerModifier.java

示例14: createJsonSerializerModifier

import com.fasterxml.jackson.databind.ser.std.BeanSerializerBase; //导入依赖的package包/类
public static BeanSerializerModifier createJsonSerializerModifier() {//final KeyFormatter keyFormatter, final boolean compactMode) {
	return new BeanSerializerModifier() {
		@Override
		public JsonSerializer<?> modifySerializer(SerializationConfig config,
												  BeanDescription beanDesc, JsonSerializer<?> serializer) {
			/*if (beanDesc.getBeanClass().isAssignableFrom(Applications.class)) {
				return new ApplicationsJsonBeanSerializer((BeanSerializerBase) serializer, keyFormatter);
			}*/
			if (beanDesc.getBeanClass().isAssignableFrom(InstanceInfo.class)) {
				return new InstanceInfoJsonBeanSerializer((BeanSerializerBase) serializer, false);
			}
			return serializer;
		}
	};
}
 
开发者ID:spring-cloud,项目名称:spring-cloud-netflix,代码行数:16,代码来源:RestTemplateTransportClientFactory.java

示例15: modifySerializer

import com.fasterxml.jackson.databind.ser.std.BeanSerializerBase; //导入依赖的package包/类
@Override
public JsonSerializer<?> modifySerializer(SerializationConfig config, BeanDescription beanDesc, JsonSerializer<?> serializer) {
    if (serializer instanceof BeanSerializerBase) {
        return new OsemBeanSerializer((BeanSerializerBase) serializer);
    }
    return serializer;

}
 
开发者ID:kzwang,项目名称:elasticsearch-osem,代码行数:9,代码来源:OsemBeanSerializerModifier.java


注:本文中的com.fasterxml.jackson.databind.ser.std.BeanSerializerBase类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。