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


Java JsonFormatVisitorWrapper.expectObjectFormat方法代码示例

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


在下文中一共展示了JsonFormatVisitorWrapper.expectObjectFormat方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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)
{
  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

示例3: 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

示例4: 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

示例5: acceptJsonFormatVisitor

import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; //导入方法依赖的package包/类
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper paramJsonFormatVisitorWrapper, JavaType paramJavaType)
{
  if (paramJsonFormatVisitorWrapper == null)
    return;
  JsonObjectFormatVisitor localJsonObjectFormatVisitor = paramJsonFormatVisitorWrapper.expectObjectFormat(paramJavaType);
  if (localJsonObjectFormatVisitor == null)
    return;
  JavaType localJavaType1 = paramJavaType.containedType(1);
  JsonSerializer localJsonSerializer1 = this._valueSerializer;
  JsonSerializer localJsonSerializer2 = localJsonSerializer1;
  if ((localJsonSerializer1 == null) && (localJavaType1 != null))
    localJsonSerializer2 = paramJsonFormatVisitorWrapper.getProvider().findValueSerializer(localJavaType1, this._property);
  if (localJavaType1 == null)
    localJavaType1 = paramJsonFormatVisitorWrapper.getProvider().constructType(Object.class);
  EnumValues localEnumValues1 = this._keyEnums;
  EnumValues localEnumValues2 = localEnumValues1;
  if (localEnumValues1 == null)
  {
    JavaType localJavaType2 = paramJavaType.containedType(0);
    if (localJavaType2 == null)
      throw new IllegalStateException("Can not resolve Enum type of EnumMap: " + paramJavaType);
    JsonSerializer localJsonSerializer3;
    if (localJavaType2 == null)
      localJsonSerializer3 = null;
    else
      localJsonSerializer3 = paramJsonFormatVisitorWrapper.getProvider().findValueSerializer(localJavaType2, this._property);
    JsonSerializer localJsonSerializer4 = localJsonSerializer3;
    if (!(localJsonSerializer3 instanceof EnumSerializer))
      throw new IllegalStateException("Can not resolve Enum type of EnumMap: " + paramJavaType);
    localEnumValues2 = ((EnumSerializer)localJsonSerializer4).getEnumValues();
  }
  Iterator localIterator = localEnumValues2.internalMap().entrySet().iterator();
  while (localIterator.hasNext())
  {
    Map.Entry localEntry = (Map.Entry)localIterator.next();
    String str = ((SerializedString)localEntry.getValue()).getValue();
    if (localJsonSerializer2 == null)
      localJsonSerializer2 = paramJsonFormatVisitorWrapper.getProvider().findValueSerializer(localEntry.getKey().getClass(), this._property);
    localJsonObjectFormatVisitor.property(str, localJsonSerializer2, localJavaType1);
  }
}
 
开发者ID:mmmsplay10,项目名称:QuizUpWinner,代码行数:42,代码来源:EnumMapSerializer.java

示例6: acceptJsonFormatVisitor

import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; //导入方法依赖的package包/类
@Override
public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType typeHint)
{
	//jackphel Aug 17 2012 : this can definitely more more exact. 
	visitor.expectObjectFormat(typeHint);
}
 
开发者ID:joyplus,项目名称:joyplus-tv,代码行数:7,代码来源:MapSerializer.java


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