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


Java DatabindContext类代码示例

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


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

示例1: typeFromId

import com.fasterxml.jackson.databind.DatabindContext; //导入依赖的package包/类
@Override
public JavaType typeFromId( DatabindContext context, String id )
{
    JavaType detectedClass = tryMatchRedfishResource( id );
    if ( detectedClass != null )
    {
        return detectedClass;
    }

    detectedClass = tryMatchRedfishCollection( id );
    if ( detectedClass != null )
    {
        return detectedClass;
    }

    throw new UnsupportedOperationException(
        "Could not determine class to deserialize into for \"@odata.type\": \"" + id + "\"" );
}
 
开发者ID:vmware,项目名称:OHMS,代码行数:19,代码来源:OdataTypeResolver.java

示例2: typeFromId

import com.fasterxml.jackson.databind.DatabindContext; //导入依赖的package包/类
@Override
public JavaType typeFromId(DatabindContext databindContext, String s) {
    Type fieldType = Schema.Type.valueOf(s);
    JavaType javaType;
    switch (fieldType) {
        case NESTED:
            javaType = TypeFactory.defaultInstance().constructType(NestedField.class);
            break;
        case ARRAY:
            javaType = TypeFactory.defaultInstance().constructType(ArrayField.class);
            break;
        default:
            javaType = TypeFactory.defaultInstance().constructType(Field.class);
    }
    return javaType;
}
 
开发者ID:hortonworks,项目名称:registry,代码行数:17,代码来源:Schema.java

示例3: typeFromId

import com.fasterxml.jackson.databind.DatabindContext; //导入依赖的package包/类
@Override
public JavaType typeFromId(DatabindContext context, String id) throws IOException {
  Class<?> subType = DefaultCredentialGenerateRequest.class;

  switch (id.toLowerCase()) {
    case CertificateCredentialVersionData.CREDENTIAL_TYPE:
      subType = CertificateGenerateRequest.class;
      break;
    case PasswordCredentialVersionData.CREDENTIAL_TYPE:
      subType = PasswordGenerateRequest.class;
      break;
    case RsaCredentialVersionData.CREDENTIAL_TYPE:
      subType = RsaGenerateRequest.class;
      break;
    case SshCredentialVersionData.CREDENTIAL_TYPE:
      subType = SshGenerateRequest.class;
      break;
    case UserCredentialVersionData.CREDENTIAL_TYPE:
      subType = UserGenerateRequest.class;
      break;
  }

  return context.constructSpecializedType(baseType, subType);
}
 
开发者ID:cloudfoundry-incubator,项目名称:credhub,代码行数:25,代码来源:GenerateRequestTypeIdResolver.java

示例4: typeFromId

import com.fasterxml.jackson.databind.DatabindContext; //导入依赖的package包/类
@Override
public JavaType typeFromId(DatabindContext context, String id) {
  DeserializationContext ctx = (DeserializationContext) context;
  Map<String, Class> map = (Map) ctx.getAttribute("secucardobjectmap");

  Class type = map.get(id);

  JavaType javatype;
  if (type == null) {
    javatype = MapType.construct(HashMap.class, SimpleType.construct(String.class), SimpleType.construct(Object.class));
  } else {
    javatype = SimpleType.construct(type);
  }

  if (JsonToken.END_ARRAY.equals(ctx.getParser().getCurrentToken())) {
    // it is expected to get called here when reading the last token.
    javatype = CollectionType.construct(ArrayList.class, javatype);
  }

  return javatype;
}
 
开发者ID:secucard,项目名称:secucard-connect-java-sdk,代码行数:22,代码来源:ObjectIdTypeResolver.java

示例5: typeFromId

import com.fasterxml.jackson.databind.DatabindContext; //导入依赖的package包/类
@Override
public JavaType typeFromId(DatabindContext context, String id) {
  JavaType type = nameToType.get(id.toLowerCase());
  if (type == null) {
    throw new NullPointerException(
        format("no subtype of %s found for enum value %s. existing mappings:\n%s",
            baseType, id, description));

  }
  return type;
}
 
开发者ID:dremio,项目名称:dremio-oss,代码行数:12,代码来源:EnumTypeIdResolver.java

示例6: typeFromId

import com.fasterxml.jackson.databind.DatabindContext; //导入依赖的package包/类
@Override
public JavaType typeFromId(DatabindContext context, String id) throws IOException {
    try {
        Class<?> type = Class.forName(id);
        return context.constructType(type);
    } catch (ClassNotFoundException e) {
        if(!(context instanceof DeserializationContext)) {
            throw new RuntimeException(e);
        }
        //see magic from ClassNameIdResolver._typeFromId()
        return ((DeserializationContext) context).handleUnknownTypeId(_baseType, id, this,
          "Class '" + id + "' not found.");
    }
}
 
开发者ID:codeabovelab,项目名称:haven-platform,代码行数:15,代码来源:CustomTypeIdResolver.java

示例7: typeFromId

import com.fasterxml.jackson.databind.DatabindContext; //导入依赖的package包/类
@Override
public JavaType typeFromId(DatabindContext context, String id) throws IOException {
  Class<?> subType;
  id = id.toLowerCase();

  switch (id) {
    case CertificateCredentialVersionData.CREDENTIAL_TYPE:
      subType = CertificateSetRequest.class;
      break;
    case ValueCredentialVersionData.CREDENTIAL_TYPE:
      subType = ValueSetRequest.class;
      break;
    case JsonCredentialVersionData.CREDENTIAL_TYPE:
      subType = JsonSetRequest.class;
      break;
    case PasswordCredentialVersionData.CREDENTIAL_TYPE:
      subType = PasswordSetRequest.class;
      break;
    case RsaCredentialVersionData.CREDENTIAL_TYPE:
      subType = RsaSetRequest.class;
      break;
    case SshCredentialVersionData.CREDENTIAL_TYPE:
      subType = SshSetRequest.class;
      break;
    case UserCredentialVersionData.CREDENTIAL_TYPE:
      subType = UserSetRequest.class;
      break;
    default:
      String message = String.format("Could not resolve type id '%s' into a subtype of %s", id, baseType);
      throw new InvalidTypeIdException(null, message, baseType, id);
  }

  return context.constructSpecializedType(baseType, subType);
}
 
开发者ID:cloudfoundry-incubator,项目名称:credhub,代码行数:35,代码来源:SetRequestTypeIdResolver.java

示例8: typeFromId

import com.fasterxml.jackson.databind.DatabindContext; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public JavaType typeFromId(final DatabindContext context,
		final String id) {
	return context.constructType(beanTypeResolver.resolveTypeClass(id,
			(Class<ConfiguredBean>) baseType.getRawClass()));
}
 
开发者ID:logsniffer,项目名称:logsniffer,代码行数:8,代码来源:ConfiguredBean.java

示例9: _typeFromId

import com.fasterxml.jackson.databind.DatabindContext; //导入依赖的package包/类
@Override
protected JavaType _typeFromId(String typeName, DatabindContext ctxt) {
    Class result = rmInfoLookup.getClass(typeName);
    if(result == null) {
        //AOM class?
        result = aomInfoLookup.getClass(typeName);
    }
    if(result != null) {
        TypeFactory typeFactory = (ctxt == null) ? _typeFactory : ctxt.getTypeFactory();
        return typeFactory.constructSpecializedType(_baseType, result);
    }
    return super._typeFromId(typeName, ctxt);
}
 
开发者ID:nedap,项目名称:archie,代码行数:14,代码来源:OpenEHRTypeNaming.java

示例10: typeFromId

import com.fasterxml.jackson.databind.DatabindContext; //导入依赖的package包/类
@Override
public JavaType typeFromId(DatabindContext context, String id) {
    Class klass = KNOWN_TYPES.get(id);
    if (klass == null) {
        return null;
    }

    JavaType[] typeArgs = klass.equals(Event.class) ?
            new JavaType[]{context.getTypeFactory().constructSimpleType(Model.class, new JavaType[]{})} :
            new JavaType[]{};

    return context.getTypeFactory().constructSimpleType(klass, typeArgs);
}
 
开发者ID:omise,项目名称:omise-java,代码行数:14,代码来源:ModelTypeResolver.java

示例11: typeFromId

import com.fasterxml.jackson.databind.DatabindContext; //导入依赖的package包/类
@Override
public JavaType typeFromId(DatabindContext context, String id) {
    Class<?> clazz = basicMetaData.getTypeClass(id);
    if (clazz == null) {
        return null;
    }
    JavaType javaType = SimpleType.construct(clazz);
    return javaType;
}
 
开发者ID:Talend,项目名称:components,代码行数:10,代码来源:NsTypeIdResolver.java

示例12: typeFromId

import com.fasterxml.jackson.databind.DatabindContext; //导入依赖的package包/类
@Override
public JavaType typeFromId( DatabindContext context, String id ) {
    final Class<?> clazz = idToClass.computeIfAbsent( id, ( k ) -> {
        throw new IllegalStateException( "cannot find id '" + k + "'" );
    } );
    return TypeFactory.defaultInstance().constructSpecializedType( baseType, clazz );
}
 
开发者ID:oaplatform,项目名称:oap,代码行数:8,代码来源:TypeIdFactory.java

示例13: typeFromId

import com.fasterxml.jackson.databind.DatabindContext; //导入依赖的package包/类
@Override
public JavaType typeFromId(DatabindContext context, String id) {
  try {
    return SimpleType.constructUnsafe(Class.forName(getClass().getPackage().getName() + "." + id.substring(0, 1).toUpperCase() + id.substring(1)));
  } catch (ClassNotFoundException e) {
    throw new RuntimeException(e);
  }
}
 
开发者ID:ferstl,项目名称:depgraph-maven-plugin,代码行数:9,代码来源:NodeTypeResolver.java

示例14: _typeFromId

import com.fasterxml.jackson.databind.DatabindContext; //导入依赖的package包/类
@Override
protected JavaType _typeFromId(final String id, final DatabindContext ctxt) throws IOException {
    Class<?> clazz = idToClass.get(id);
    if (clazz != null) {
        return _typeFactory.constructSpecializedType(_baseType, clazz);
    }

    return super._typeFromId(id, ctxt);
}
 
开发者ID:ragnor,项目名称:simple-spring-memcached,代码行数:10,代码来源:ClassAliasIdResolver.java

示例15: typeFromId

import com.fasterxml.jackson.databind.DatabindContext; //导入依赖的package包/类
@Override
public JavaType typeFromId(DatabindContext context, String id) {
    if ("set".equals(id)) {
        return context.getTypeFactory().constructCollectionType(OvsdbSet.class, Object.class);
    } else if ("uuid".equals(id) || "named-uuid".equals(id)) {
        return context.constructType(UUID.class);
    }
    return null;
}
 
开发者ID:opendaylight,项目名称:ovsdb,代码行数:10,代码来源:OvsdbTypesIdResolver.java


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