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


Java TypeSerializer类代码示例

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


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

示例1: serializeWithType

import com.fasterxml.jackson.databind.jsontype.TypeSerializer; //导入依赖的package包/类
@Override
public void serializeWithType(HibernateProxy value, JsonGenerator jgen,
		SerializerProvider provider, TypeSerializer typeSer)
		throws IOException, JsonProcessingException {
	Object proxiedValue = findProxied(value);
	if (proxiedValue == null) {
		provider.defaultSerializeNull(jgen);
		return;
	}
	/*
	 * This isn't exactly right, since type serializer really refers to
	 * proxy object, not value. And we really don't either know static type
	 * (necessary to know how to apply additional type info) or other
	 * things; so it's not going to work well. But... we'll do out best.
	 */
	findSerializer(provider, proxiedValue).serializeWithType(proxiedValue,
			jgen, provider, typeSer);
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:19,代码来源:HibernateProxySerializer.java

示例2: serializeWithType

import com.fasterxml.jackson.databind.jsontype.TypeSerializer; //导入依赖的package包/类
@Override
public void serializeWithType(LocalDateTime value, JsonGenerator g, SerializerProvider provider,
        TypeSerializer typeSer) throws IOException
{
    WritableTypeId typeIdDef = typeSer.writeTypePrefix(g,
            typeSer.typeId(value, serializationShape(provider)));
    // need to write out to avoid double-writing array markers
    if (typeIdDef.valueShape == JsonToken.START_ARRAY) {
        _serializeAsArrayContents(value, g, provider);
    } else {
        DateTimeFormatter dtf = _formatter;
        if (dtf == null) {
            dtf = _defaultFormatter();
        }
        g.writeString(value.format(dtf));
    }
    typeSer.writeTypeSuffix(g, typeIdDef);
}
 
开发者ID:FasterXML,项目名称:jackson-modules-java8,代码行数:19,代码来源:LocalDateTimeSerializer.java

示例3: serializeWithType

import com.fasterxml.jackson.databind.jsontype.TypeSerializer; //导入依赖的package包/类
@Override
public void serializeWithType(final X509CertificateCredential value, final JsonGenerator generator, 
                              final SerializerProvider serializers, final TypeSerializer typeSer) throws IOException {
    try {

        typeSer.writeTypePrefixForObject(value, generator);
        serialize(value, generator, serializers); 
        typeSer.writeTypeSuffixForObject(value, generator);
    } catch (final Exception e) {
        throw new JsonMappingException("Unable to serialize X509 certificate", e);
    }
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:13,代码来源:X509CertificateCredentialJsonSerializer.java

示例4: serializeWithType

import com.fasterxml.jackson.databind.jsontype.TypeSerializer; //导入依赖的package包/类
@Override
public void serializeWithType(JoinFunction value, JsonGenerator gen, SerializerProvider serializers,
    TypeSerializer typeSer) throws IOException {
    typeSer.writeTypePrefixForScalar(value, gen);
    serialize(value, gen, serializers);
    typeSer.writeTypeSuffixForScalar(value, gen);
}
 
开发者ID:salesforce,项目名称:cf2pojo,代码行数:8,代码来源:JoinFunction.java

示例5: serializeWithType

import com.fasterxml.jackson.databind.jsontype.TypeSerializer; //导入依赖的package包/类
@Override
public void serializeWithType(SelectFunction value, JsonGenerator gen, SerializerProvider serializers,
    TypeSerializer typeSer) throws IOException {
    typeSer.writeTypePrefixForScalar(value, gen);
    serialize(value, gen, serializers);
    typeSer.writeTypeSuffixForScalar(value, gen);
}
 
开发者ID:salesforce,项目名称:cf2pojo,代码行数:8,代码来源:SelectFunction.java

示例6: serializeWithType

import com.fasterxml.jackson.databind.jsontype.TypeSerializer; //导入依赖的package包/类
@Override
public void serializeWithType(StringValue value, JsonGenerator gen, SerializerProvider serializers,
    TypeSerializer typeSer) throws IOException {
    typeSer.writeTypePrefixForScalar(value, gen);
    serialize(value, gen, serializers);
    typeSer.writeTypeSuffixForScalar(value, gen);
}
 
开发者ID:salesforce,项目名称:cf2pojo,代码行数:8,代码来源:StringValue.java

示例7: serializeWithType

import com.fasterxml.jackson.databind.jsontype.TypeSerializer; //导入依赖的package包/类
@Override
public void serializeWithType(
    com.salesforce.cf2pojo.model.RefValue value, JsonGenerator gen, SerializerProvider serializers,
    TypeSerializer typeSer) throws IOException {
    typeSer.writeTypePrefixForScalar(value, gen);
    serialize(value, gen, serializers);
    typeSer.writeTypeSuffixForScalar(value, gen);
}
 
开发者ID:salesforce,项目名称:cf2pojo,代码行数:9,代码来源:RefValue.java

示例8: serializeWithType

import com.fasterxml.jackson.databind.jsontype.TypeSerializer; //导入依赖的package包/类
@Override
public void serializeWithType(com.salesforce.cf2pojo.model.GetAttFunction value, JsonGenerator gen,
    SerializerProvider serializers, TypeSerializer typeSer) throws IOException {
    typeSer.writeTypePrefixForScalar(value, gen);
    serialize(value, gen, serializers);
    typeSer.writeTypeSuffixForScalar(value, gen);
}
 
开发者ID:salesforce,项目名称:cf2pojo,代码行数:8,代码来源:GetAttFunction.java

示例9: serializeWithType

import com.fasterxml.jackson.databind.jsontype.TypeSerializer; //导入依赖的package包/类
@Override
public void serializeWithType(Base64Function value, JsonGenerator gen, SerializerProvider serializers,
    TypeSerializer typeSer) throws IOException {
    typeSer.writeTypePrefixForScalar(value, gen);
    serialize(value, gen, serializers);
    typeSer.writeTypeSuffixForScalar(value, gen);
}
 
开发者ID:salesforce,项目名称:cf2pojo,代码行数:8,代码来源:Base64Function.java

示例10: serializeWithType

import com.fasterxml.jackson.databind.jsontype.TypeSerializer; //导入依赖的package包/类
@Override
public void serializeWithType(SubFunction value, JsonGenerator gen, SerializerProvider serializers,
    TypeSerializer typeSer) throws IOException {
    typeSer.writeTypePrefixForScalar(value, gen);
    serialize(value, gen, serializers);
    typeSer.writeTypeSuffixForScalar(value, gen);
}
 
开发者ID:salesforce,项目名称:cf2pojo,代码行数:8,代码来源:SubFunction.java

示例11: serializeWithType

import com.fasterxml.jackson.databind.jsontype.TypeSerializer; //导入依赖的package包/类
@Override
public void serializeWithType(FindInMapFunction value, JsonGenerator gen, SerializerProvider serializers,
    TypeSerializer typeSer) throws IOException {
    typeSer.writeTypePrefixForScalar(value, gen);
    serialize(value, gen, serializers);
    typeSer.writeTypeSuffixForScalar(value, gen);
}
 
开发者ID:salesforce,项目名称:cf2pojo,代码行数:8,代码来源:FindInMapFunction.java

示例12: serializeWithType

import com.fasterxml.jackson.databind.jsontype.TypeSerializer; //导入依赖的package包/类
@Override
public void serializeWithType(IfFunction value, JsonGenerator gen, SerializerProvider serializers,
    TypeSerializer typeSer) throws IOException {
    typeSer.writeTypePrefixForScalar(value, gen);
    serialize(value, gen, serializers);
    typeSer.writeTypeSuffixForScalar(value, gen);
}
 
开发者ID:salesforce,项目名称:cf2pojo,代码行数:8,代码来源:IfFunction.java

示例13: serializeWithType

import com.fasterxml.jackson.databind.jsontype.TypeSerializer; //导入依赖的package包/类
@Override
public void serializeWithType(BigDecimal value, JsonGenerator gen, SerializerProvider provider,
        TypeSerializer typeSer) throws IOException {
    typeSer.writeTypePrefixForScalar(value, gen);
    serialize(value, gen, provider);
    typeSer.writeTypeSuffixForScalar(value, gen);
}
 
开发者ID:SolarNetwork,项目名称:killbill-easytax-plugin,代码行数:8,代码来源:BigDecimalStringSerializer.java

示例14: serializeFieldTyped

import com.fasterxml.jackson.databind.jsontype.TypeSerializer; //导入依赖的package包/类
protected void serializeFieldTyped(
        Entity entity,
        JsonGenerator gen,
        SerializerProvider serializers,
        BeanDescription beanDescription,
        BeanPropertyDefinition beanPropertyDefinition,
        TypeSerializer typeSerializer) throws Exception {
    try {
        if (typeSerializer == null) {
            typeSerializer = serializers.findTypeSerializer(serializers.constructType(beanPropertyDefinition.getAccessor().getRawType()));
        }
        if (typeSerializer == null) {
            // if not static type if available use dynamic type if available
            Object propertyValue = beanPropertyDefinition.getAccessor().getValue(entity);
            if (propertyValue != null) {
                typeSerializer = serializers.findTypeSerializer(serializers.constructType(propertyValue.getClass()));
            }
        }

        BeanPropertyWriter bpw = new BeanPropertyWriter(
                beanPropertyDefinition,
                beanPropertyDefinition.getAccessor(),
                beanDescription.getClassAnnotations(),
                beanPropertyDefinition.getAccessor().getType(),
                null, // will be searched automatically
                typeSerializer, // will not be searched automatically
                beanPropertyDefinition.getAccessor().getType(),
                suppressNulls(serializers.getConfig().getDefaultPropertyInclusion()),
                suppressableValue(serializers.getConfig().getDefaultPropertyInclusion()));
        bpw.serializeAsField(entity, gen, serializers);
    } catch (JsonMappingException ex) {
        Logger.getLogger(EntitySerializer.class.getName()).log(Level.SEVERE, null, ex);
    }
}
 
开发者ID:FraunhoferIOSB,项目名称:SensorThingsServer,代码行数:35,代码来源:EntitySerializer.java

示例15: serializeWithType

import com.fasterxml.jackson.databind.jsontype.TypeSerializer; //导入依赖的package包/类
@Override
public void serializeWithType( final ContainerResource value, final JsonGenerator gen,
                               final SerializerProvider serializers, final TypeSerializer typeSer )
        throws IOException
{
    typeSer.writeTypePrefixForObject( value, gen );
    serialize( value, gen, serializers );
    typeSer.writeTypeSuffixForObject( value, gen );
}
 
开发者ID:subutai-io,项目名称:base,代码行数:10,代码来源:ContainerResourceSerializer.java


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