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


Java JsonFormatVisitorWrapper类代码示例

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


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

示例1: acceptJsonFormatVisitor

import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; //导入依赖的package包/类
@Override
public void acceptJsonFormatVisitor(final JsonFormatVisitorWrapper wrapper, final JavaType hint)
        throws JsonMappingException {

    final JsonObjectFormatVisitor visitor = wrapper.expectObjectFormat(hint);

    visitor.property(names.getAmount(),
            wrapper.getProvider().findValueSerializer(writer.getType()),
            wrapper.getProvider().constructType(writer.getType()));

    visitor.property(names.getCurrency(),
            wrapper.getProvider().findValueSerializer(CurrencyUnit.class),
            wrapper.getProvider().constructType(CurrencyUnit.class));

    visitor.optionalProperty(names.getFormatted(),
            wrapper.getProvider().findValueSerializer(String.class),
            wrapper.getProvider().constructType(String.class));
}
 
开发者ID:zalando,项目名称:jackson-datatype-money,代码行数:19,代码来源:MonetaryAmountSerializer.java

示例2: acceptJsonFormatVisitor

import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; //导入依赖的package包/类
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper paramJsonFormatVisitorWrapper, JavaType paramJavaType)
{
  JsonSerializer localJsonSerializer1 = this._valueSerializer;
  Object localObject = localJsonSerializer1;
  if (localJsonSerializer1 == null)
  {
    if (paramJavaType == null)
    {
      if (this._property != null)
        paramJavaType = this._property.getType();
      if (paramJavaType == null)
        paramJavaType = paramJsonFormatVisitorWrapper.getProvider().constructType(this._accessorMethod.getReturnType());
    }
    JsonSerializer localJsonSerializer2 = paramJsonFormatVisitorWrapper.getProvider().findTypedValueSerializer(paramJavaType, false, this._property);
    localObject = localJsonSerializer2;
    if (localJsonSerializer2 == null)
    {
      paramJsonFormatVisitorWrapper.expectAnyFormat(paramJavaType);
      return;
    }
  }
  ((JsonSerializer)localObject).acceptJsonFormatVisitor(paramJsonFormatVisitorWrapper, null);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:24,代码来源:JsonValueSerializer.java

示例3: acceptJsonFormatVisitor

import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; //导入依赖的package包/类
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper paramJsonFormatVisitorWrapper, JavaType paramJavaType)
{
  JsonMapFormatVisitor localJsonMapFormatVisitor1;
  if (paramJsonFormatVisitorWrapper == null)
    localJsonMapFormatVisitor1 = null;
  else
    localJsonMapFormatVisitor1 = paramJsonFormatVisitorWrapper.expectMapFormat(paramJavaType);
  JsonMapFormatVisitor localJsonMapFormatVisitor2 = localJsonMapFormatVisitor1;
  if (localJsonMapFormatVisitor1 != null)
  {
    localJsonMapFormatVisitor2.keyFormat(this._keySerializer, this._keyType);
    JsonSerializer localJsonSerializer1 = this._valueSerializer;
    JsonSerializer localJsonSerializer2 = localJsonSerializer1;
    if (localJsonSerializer1 == null)
      localJsonSerializer2 = _findAndAddDynamic(this._dynamicValueSerializers, this._valueType, paramJsonFormatVisitorWrapper.getProvider());
    localJsonMapFormatVisitor2.valueFormat(localJsonSerializer2, this._valueType);
  }
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:19,代码来源:MapSerializer.java

示例4: acceptJsonFormatVisitor

import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; //导入依赖的package包/类
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper paramJsonFormatVisitorWrapper, JavaType paramJavaType)
{
  boolean bool1 = this._useTimestamp;
  boolean bool2 = bool1;
  if ((!bool1) && (this._customFormat == null))
    bool2 = paramJsonFormatVisitorWrapper.getProvider().isEnabled(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
  if (bool2)
  {
    JsonIntegerFormatVisitor localJsonIntegerFormatVisitor = paramJsonFormatVisitorWrapper.expectIntegerFormat(paramJavaType);
    if (localJsonIntegerFormatVisitor != null)
    {
      localJsonIntegerFormatVisitor.numberType(JsonParser.NumberType.LONG);
      localJsonIntegerFormatVisitor.format(JsonValueFormat.UTC_MILLISEC);
    }
    return;
  }
  JsonStringFormatVisitor localJsonStringFormatVisitor = paramJsonFormatVisitorWrapper.expectStringFormat(paramJavaType);
  if (localJsonStringFormatVisitor != null)
    localJsonStringFormatVisitor.format(JsonValueFormat.DATE_TIME);
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:21,代码来源:DateTimeSerializerBase.java

示例5: acceptJsonFormatVisitor

import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; //导入依赖的package包/类
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper paramJsonFormatVisitorWrapper, JavaType paramJavaType)
{
  if (paramJsonFormatVisitorWrapper.getProvider().isEnabled(SerializationFeature.WRITE_ENUMS_USING_INDEX))
  {
    JsonIntegerFormatVisitor localJsonIntegerFormatVisitor = paramJsonFormatVisitorWrapper.expectIntegerFormat(paramJavaType);
    if (localJsonIntegerFormatVisitor != null)
      localJsonIntegerFormatVisitor.numberType(JsonParser.NumberType.INT);
    return;
  }
  JsonStringFormatVisitor localJsonStringFormatVisitor = paramJsonFormatVisitorWrapper.expectStringFormat(paramJavaType);
  if ((paramJavaType != null) && (localJsonStringFormatVisitor != null) && (paramJavaType.isEnumType()))
  {
    LinkedHashSet localLinkedHashSet = new LinkedHashSet();
    Iterator localIterator = this._values.values().iterator();
    while (localIterator.hasNext())
      localLinkedHashSet.add(((SerializedString)localIterator.next()).getValue());
    localJsonStringFormatVisitor.enumTypes(localLinkedHashSet);
  }
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:20,代码来源:EnumSerializer.java

示例6: acceptJsonFormatVisitor

import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; //导入依赖的package包/类
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper paramJsonFormatVisitorWrapper, JavaType paramJavaType)
{
  JsonObjectFormatVisitor localJsonObjectFormatVisitor1;
  if (paramJsonFormatVisitorWrapper == null)
    localJsonObjectFormatVisitor1 = null;
  else
    localJsonObjectFormatVisitor1 = paramJsonFormatVisitorWrapper.expectObjectFormat(paramJavaType);
  JsonObjectFormatVisitor localJsonObjectFormatVisitor2 = localJsonObjectFormatVisitor1;
  if (localJsonObjectFormatVisitor1 != null)
  {
    if (this._propertyFilterId != null)
    {
      BeanPropertyFilter localBeanPropertyFilter = findFilter(paramJsonFormatVisitorWrapper.getProvider());
      for (int j = 0; j < this._props.length; j++)
        localBeanPropertyFilter.depositSchemaProperty(this._props[j], localJsonObjectFormatVisitor2, paramJsonFormatVisitorWrapper.getProvider());
      return;
    }
    for (int i = 0; i < this._props.length; i++)
      this._props[i].depositSchemaProperty(localJsonObjectFormatVisitor2);
  }
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:22,代码来源:BeanSerializerBase.java

示例7: acceptJsonFormatVisitor

import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; //导入依赖的package包/类
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper paramJsonFormatVisitorWrapper, JavaType paramJavaType)
{
  JsonArrayFormatVisitor localJsonArrayFormatVisitor1;
  if (paramJsonFormatVisitorWrapper == null)
    localJsonArrayFormatVisitor1 = null;
  else
    localJsonArrayFormatVisitor1 = paramJsonFormatVisitorWrapper.expectArrayFormat(paramJavaType);
  JsonArrayFormatVisitor localJsonArrayFormatVisitor2 = localJsonArrayFormatVisitor1;
  if (localJsonArrayFormatVisitor1 != null)
  {
    JavaType localJavaType = paramJsonFormatVisitorWrapper.getProvider().getTypeFactory().moreSpecificType(this._elementType, paramJavaType.getContentType());
    if (localJavaType == null)
      throw new JsonMappingException("Could not resolve type");
    JsonSerializer localJsonSerializer1 = this._elementSerializer;
    JsonSerializer localJsonSerializer2 = localJsonSerializer1;
    if (localJsonSerializer1 == null)
      localJsonSerializer2 = paramJsonFormatVisitorWrapper.getProvider().findValueSerializer(localJavaType, this._property);
    localJsonArrayFormatVisitor2.itemsFormat(localJsonSerializer2, localJavaType);
  }
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:21,代码来源:AsArraySerializerBase.java

示例8: acceptJsonFormatVisitor

import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; //导入依赖的package包/类
@Override
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)
{
    //todo: (ryan) add a format for the date in the schema?
    boolean asNumber = _useTimestamp;
    if (!asNumber) {
        if (_customFormat == null) {
            asNumber = visitor.getProvider().isEnabled(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
        }
    }
    if (asNumber) {
    	visitor.expectNumberFormat(typeHint).format(JsonValueFormat.UTC_MILLISEC);
    } else {
    	visitor.expectStringFormat(typeHint).format(JsonValueFormat.DATE_TIME);
    }
}
 
开发者ID:joyplus,项目名称:joyplus-tv,代码行数:17,代码来源:DateTimeSerializerBase.java

示例9: acceptJsonFormatVisitor

import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; //导入依赖的package包/类
@Override
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)
{
    // [JACKSON-684]: serialize as index?
	if (visitor.getProvider().isEnabled(SerializationFeature.WRITE_ENUMS_USING_INDEX)) {
		visitor.expectIntegerFormat(typeHint);
	} else {
		JsonStringFormatVisitor stringVisitor = visitor.expectStringFormat(typeHint);
		if (typeHint != null) {
			if (typeHint.isEnumType()) {
				Set<String> enums = new HashSet<String>();
				for (SerializedString value : _values.values()) {
					enums.add(value.getValue());
				}
				stringVisitor.enumTypes(enums);
			}
		}
	}
}
 
开发者ID:joyplus,项目名称:joyplus-tv,代码行数:20,代码来源:EnumSerializer.java

示例10: acceptJsonFormatVisitor

import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; //导入依赖的package包/类
@Override
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)
    throws JsonMappingException
{
	//deposit your output format 
	JsonObjectFormatVisitor objectVisitor = visitor.expectObjectFormat(typeHint);
 
    if (_propertyFilterId != null) {
        BeanPropertyFilter filter = findFilter(visitor.getProvider());
        for (int i = 0; i < _props.length; i++) {
            filter.depositSchemaProperty(_props[i], objectVisitor, visitor.getProvider());
        }
    } else {
        for (int i = 0; i < _props.length; i++) {
            _props[i].depositSchemaProperty(objectVisitor);
        }
    }
}
 
开发者ID:joyplus,项目名称:joyplus-tv,代码行数:19,代码来源:BeanSerializerBase.java

示例11: acceptJsonFormatVisitor

import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; //导入依赖的package包/类
@Override
    public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)
        throws JsonMappingException
    {
    	JsonObjectFormatVisitor objectVisitor = visitor.expectObjectFormat(typeHint);
    	/*
        JavaType enumType = typeHint.containedType(0);
    	if (enumType == null) {
    	    enumType = visitor.getProvider().constructType(Object.class);
    	}
    	*/
        JavaType valueType = typeHint.containedType(1);
    	if (valueType == null) {
    	    valueType = visitor.getProvider().constructType(Object.class);
    	}
        JsonSerializer<Object> ser = _valueSerializer;
//        Class<Enum<?>> enumClass = (Class<Enum<?>>) enumType.getRawClass();
        for (Map.Entry<?,SerializedString> entry : _keyEnums.internalMap().entrySet()) {
            String name = entry.getValue().getValue();
            // should all have the same type, so:
            if (ser == null) {
                ser = visitor.getProvider().findValueSerializer(entry.getKey().getClass(), _property);
            }
            objectVisitor.property(name, (JsonFormatVisitable) ser, valueType);
        }
    }
 
开发者ID:joyplus,项目名称:joyplus-tv,代码行数:27,代码来源:EnumMapSerializer.java

示例12: acceptJsonFormatVisitor

import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; //导入依赖的package包/类
@Override
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)
        throws JsonMappingException {
    if (visitor != null) {
        visitor.expectStringFormat(typeHint);
    }
}
 
开发者ID:SolarNetwork,项目名称:killbill-easytax-plugin,代码行数:8,代码来源:BigDecimalStringSerializer.java

示例13: _acceptTimestampVisitor

import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; //导入依赖的package包/类
@Override
protected void _acceptTimestampVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException
{
    SerializerProvider provider = visitor.getProvider();
    boolean useTimestamp = (provider != null) && useTimestamp(provider);
    if (useTimestamp) {
        super._acceptTimestampVisitor(visitor, typeHint);
    } else {
        JsonStringFormatVisitor v2 = visitor.expectStringFormat(typeHint);
        if (v2 != null) {
            v2.format(JsonValueFormat.DATE_TIME);
        }
    }
}
 
开发者ID:FasterXML,项目名称:jackson-modules-java8,代码行数:15,代码来源:YearMonthSerializer.java

示例14: _acceptTimestampVisitor

import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; //导入依赖的package包/类
@Override
protected void _acceptTimestampVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException
{
    JsonIntegerFormatVisitor v2 = visitor.expectIntegerFormat(typeHint);
    if (v2 != null) {
        v2.numberType(JsonParser.NumberType.LONG);
        SerializerProvider provider = visitor.getProvider();
        if ((provider != null) && provider.isEnabled(SerializationFeature.WRITE_DATE_TIMESTAMPS_AS_NANOSECONDS)) {
            // big number, no more specific qualifier to use...
        } else { // otherwise good old Unix timestamp, in milliseconds
            v2.format(JsonValueFormat.UTC_MILLISEC);
        }
    }
}
 
开发者ID:FasterXML,项目名称:jackson-modules-java8,代码行数:15,代码来源:DurationSerializer.java

示例15: acceptJsonFormatVisitor

import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; //导入依赖的package包/类
@Override
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint) throws JsonMappingException
{
    SerializerProvider provider = visitor.getProvider();
    boolean useTimestamp = (provider != null) && useTimestamp(provider);
    if (useTimestamp) {
        _acceptTimestampVisitor(visitor, typeHint);
    } else {
        JsonStringFormatVisitor v2 = visitor.expectStringFormat(typeHint);
        if (v2 != null) {
            v2.format(JsonValueFormat.DATE_TIME);
        }
    }
}
 
开发者ID:FasterXML,项目名称:jackson-modules-java8,代码行数:15,代码来源:JSR310FormattedSerializerBase.java


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