當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。