static FudgeTypeConverter<?, ?> findTypeConverter( FudgeDeserializer deserializer, List<FudgeField> fields) { for (FudgeField type : fields) { final Object obj = type.getValue(); if (obj instanceof Number) { throw new UnsupportedOperationException( "Serialisation framework does not support back/forward references"); } else if (obj instanceof String) { try { Class<?> cls = deserializer.getFudgeContext().getTypeDictionary().loadClass((String) obj); FudgeFieldType fieldType = deserializer.getFudgeContext().getTypeDictionary().getByJavaType(cls); if (fieldType != null && (fieldType instanceof FudgeTypeConverter)) { return (FudgeTypeConverter<?, ?>) fieldType; } } catch (ClassNotFoundException ex) { // ignore } } } return null; }
static FudgeObjectBuilder<?> findObjectBuilder( FudgeDeserializer deserializer, List<FudgeField> fields) { FudgeObjectBuilder<?> objectBuilder = null; for (FudgeField type : fields) { final Object obj = type.getValue(); if (obj instanceof Number) { throw new UnsupportedOperationException( "Serialisation framework does not support back/forward references"); } else if (obj instanceof String) { try { Class<?> cls = deserializer.getFudgeContext().getTypeDictionary().loadClass((String) obj); objectBuilder = deserializer.getFudgeContext().getObjectDictionary().getObjectBuilder(cls); if (objectBuilder != null) { return objectBuilder; } } catch (ClassNotFoundException ex) { // ignore } } } return null; }