本文整理汇总了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 + "\"" );
}
示例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;
}
示例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);
}
示例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;
}
示例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;
}
示例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.");
}
}
示例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);
}
示例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()));
}
示例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);
}
示例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);
}
示例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;
}
示例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 );
}
示例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);
}
}
示例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);
}
示例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;
}