Examples of ObjectMatch


Examples of com.metaparadigm.jsonrpc.ObjectMatch

    }
    if (match == 0) {
      throw new UnmarshallException("bean has no matches");
    }

    ObjectMatch m = null, tmp;
    i = jso.keys();
    while (i.hasNext()) {
      String field = (String) i.next();
      Method setMethod = bd.writableProps.get(field);
      if (setMethod != null) {
        try {
          Class[] param = setMethod.getParameterTypes();
          if (param.length != 1) {
            throw new UnmarshallException("bean " + clazz.getName() + " method "
                + setMethod.getName() + " does not have one arg");
          }
          tmp = ser.tryUnmarshall(state, param[0], jso.get(field));
          if (m == null) {
            m = tmp;
          } else {
            m = m.max(tmp);
          }
        } catch (UnmarshallException e) {
          throw new UnmarshallException("bean " + clazz.getName() + " " + e.getMessage());
        }
      } else {
        mismatch++;
      }
    }
    return m.max(new ObjectMatch(mismatch));
  }
View Full Code Here

Examples of org.jabsorb.serializer.ObjectMatch

    @Override
    public ObjectMatch tryUnmarshall(final SerializerState state,
                                     final Class<?> clazz, final Object jso)
            throws UnmarshallException {
        final ObjectMatch toReturn;
        if (jso instanceof StatusCodes) {
            toReturn = ObjectMatch.OKAY;
        } else {
            toReturn = ObjectMatch.ROUGHLY_SIMILAR;
        }
View Full Code Here

Examples of org.jabsorb.serializer.ObjectMatch

      if (best == null)
      {
        best = c;
        continue;
      }
      final ObjectMatch bestMatch = best.getMatch();
      final ObjectMatch cMatch = c.getMatch();
      if (bestMatch.getMismatch() > cMatch.getMismatch())
      {
        best = c;
      }
      else if (bestMatch.getMismatch() == cMatch.getMismatch())
      {
        best = betterSignature(best, c);
      }
    }
    if (best != null)
View Full Code Here

Examples of org.jabsorb.serializer.ObjectMatch

      }
      if (mismatch == -1)
      {
        return ObjectMatch.OKAY;
      }
      return new ObjectMatch(mismatch);
    }
View Full Code Here

Examples of org.jabsorb.serializer.ObjectMatch

      throw new UnmarshallException("Could not read dictionary: " + e.getMessage(), e);
    }
    if (jsondictionary == null) {
      throw new UnmarshallException("nsdictionary missing");
    }
    ObjectMatch m = new ObjectMatch(-1);
    Iterator i = jsondictionary.keys();
    String key = null;
    state.setSerialized(o, m);
    try {
      while (i.hasNext()) {
        key = (String) i.next();
        m.setMismatch(ser.tryUnmarshall(state, null, jsondictionary.get(key)).max(m).getMismatch());
      }
    }
    catch (UnmarshallException e) {
      throw new UnmarshallException("key " + key + " " + e.getMessage(), e);
    }
View Full Code Here

Examples of org.jabsorb.serializer.ObjectMatch

      JSONObject jsonset = jso.getJSONObject("set");
      if (jsonset == null) {
        throw new UnmarshallException("set missing");
      }

      ObjectMatch m = new ObjectMatch(-1);

      Iterator i = jsonset.keys();
      String key = null;

      try {
View Full Code Here

Examples of org.jabsorb.serializer.ObjectMatch

    if (match == 0) {
      throw new UnmarshallException("bean has no matches");
    }

    // create a concrete ObjectMatch that is always returned in order to satisfy circular reference requirements
    ObjectMatch returnValue = new ObjectMatch(-1);
    state.setSerialized(o, returnValue);

    ObjectMatch m = null;
    ObjectMatch tmp;
    Iterator<String> i = jso.keys();
    while (i.hasNext()) {
      String field = i.next();
      Method setMethod = bd.writableProps.get(field);
      if (setMethod != null) {
        try {
          Class<?> param[] = setMethod.getParameterTypes();
          if (param.length != 1) {
            throw new UnmarshallException("bean " + clazz.getName() + " method " + setMethod.getName() + " does not have one arg");
          }
          tmp = ser.tryUnmarshall(state, param[0], jso.get(field));
          if (tmp != null) {
            if (m == null) {
              m = tmp;
            }
            else {
              m = m.max(tmp);
            }
          }
        }
        catch (UnmarshallException e) {
          throw new UnmarshallException("bean " + clazz.getName() + " " + e.getMessage(), e);
        }
        catch (JSONException e) {
          throw new UnmarshallException("bean " + clazz.getName() + " " + e.getMessage(), e);
        }
      }
      else {
        mismatch++;
      }
    }
    if (m != null) {
      returnValue.setMismatch(m.max(new ObjectMatch(mismatch)).getMismatch());
    }
    else {
      returnValue.setMismatch(mismatch);
    }
    return returnValue;
View Full Code Here

Examples of org.jabsorb.serializer.ObjectMatch

    }
    if (jsonNSArray == null) {
      throw new UnmarshallException("nsarray missing");
    }
    int i = 0;
    ObjectMatch m = new ObjectMatch(-1);
    state.setSerialized(o, m);
    try {
      for (; i < jsonNSArray.length(); i++) {
        m.setMismatch(ser.tryUnmarshall(state, null, jsonNSArray.get(i)).max(m).getMismatch());
      }
    }
    catch (UnmarshallException e) {
      throw new UnmarshallException("element " + i + " " + e.getMessage(), e);
    }
View Full Code Here

Examples of org.sf.bee.commons.remoting.jrpc.serializer.ObjectMatch

        if (match == 0) {
            throw new UnmarshallException("bean has no matches");
        }

        // create a concrete ObjectMatch that is always returned in order to satisfy circular reference requirements
        ObjectMatch returnValue = new ObjectMatch(-1);
        state.setSerialized(o, returnValue);

        ObjectMatch m = null;
        ObjectMatch tmp;
        i = jso.keys();
        while (i.hasNext()) {
            String field = (String) i.next();
            Method setMethod = (Method) bd.writableProps.get(field);
            if (setMethod != null) {
                try {
                    Class param[] = setMethod.getParameterTypes();
                    if (param.length != 1) {
                        throw new UnmarshallException("bean " + clazz.getName() + " method " + setMethod.getName() + " does not have one arg");
                    }
                    tmp = _ser.tryUnmarshall(state, param[0], jso.get(field));
                    if (tmp != null) {
                        if (m == null) {
                            m = tmp;
                        } else {
                            m = m.max(tmp);
                        }
                    }
                } catch (UnmarshallException e) {
                    throw new UnmarshallException("bean " + clazz.getName() + " " + e.getMessage(), e);
                } catch (JSONException e) {
                    throw new UnmarshallException("bean " + clazz.getName() + " " + e.getMessage(), e);
                }
            } else {
                mismatch++;
            }
        }
        if (m != null) {
            returnValue.setMismatch(m.max(new ObjectMatch(mismatch)).getMismatch());
        } else {
            returnValue.setMismatch(mismatch);
        }
        return returnValue;
    }
View Full Code Here

Examples of org.sf.bee.commons.remoting.jrpc.serializer.ObjectMatch

        }
        if (jsonlist == null) {
            throw new UnmarshallException("list missing");
        }
        int i = 0;
        ObjectMatch m = new ObjectMatch(-1);
        state.setSerialized(o, m);
        try {
            for (; i < jsonlist.length(); i++) {
                m.setMismatch(_ser.tryUnmarshall(state, null, jsonlist.get(i)).max(m).getMismatch());
            }
        } catch (UnmarshallException e) {
            throw new UnmarshallException("element " + i + " " + e.getMessage(), e);
        } catch (JSONException e) {
            throw new UnmarshallException("element " + i + " " + e.getMessage(), e);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.