コード例 #1
0
ファイル: BuilderUtil.java プロジェクト: OpenGamma/Fudge-Java
 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;
 }
コード例 #2
0
ファイル: BuilderUtil.java プロジェクト: OpenGamma/Fudge-Java
 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;
 }