本文整理汇总了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;
}
示例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;
}
});
}
示例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;
}
});
}
示例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;
}
示例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;
}
}
});
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
});
}
});
}
示例11: withObjectIdWriter
import com.fasterxml.jackson.databind.ser.std.BeanSerializerBase; //导入依赖的package包/类
@Override
public BeanSerializerBase withObjectIdWriter(ObjectIdWriter objectIdWriter) {
return new ResourceDecoratorSerializer<>(
this,
objectIdWriter,
resourceContext,
resourceDecorator
);
}
示例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
);
}
示例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);
}
}
示例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;
}
};
}
示例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;
}