Package com.skaringa.javaxml

Examples of com.skaringa.javaxml.DeserializerException


      return activate.invoke(obj, new Object[0]);
    } catch (NoSuchMethodException e) {
      return obj;
    } catch (IllegalAccessException e) {
      throw new DeserializerException("can't access method " + methodName
          + " of class: " + _xmlTypeName);
    } catch (InvocationTargetException e) {
      throw new DeserializerException("exception in " + methodName + ": "
          + e.getMessage());
    }
  }
View Full Code Here


          .getObj();
      if (clazz.isInstance(obj)) {
        return obj;
      }
    }
    throw new DeserializerException("Object of class " + clazz.getName()
        + " not found in object hierarchy.");
  }
View Full Code Here

   */
  public void setMember(Object parent, String name, Object value)
    throws DeserializerException {

    if (name == null) {
      throw new DeserializerException("member of map must have an name");
    }
   
    if (!name.equals("mapentry")) {
      value = new MapEntryHelper(name, value);
    }

    if (parent == null) {
      throw new DeserializerException("child of null object is forbidden");
    }

    try {
      MapEntryHelper entry = (MapEntryHelper) value;
      Map map = (Map) parent;
      map.put(entry.getKey(), entry.getValue());
    }
    catch (ClassCastException e) {
      throw new DeserializerException("invalid sequence: " + e.toString());
    }
  }
View Full Code Here

   */
  public void setMember(Object parent, String name, Object value)
    throws DeserializerException {

    if (parent == null) {
      throw new DeserializerException("child of null object is forbidden");
    }

    if (parent instanceof Collection) {
      Collection coll = (Collection) parent;
      coll.add(value);
    }
    else {
      throw new DeserializerException(
        "invalid sequence: java.util.Collection expected, but was: "
          + parent.getClass().getName());
    }
  }
View Full Code Here

      // create a new object
      Constructor ctor = _wrapperType.getConstructor(ctorArgTypes);
      obj = ctor.newInstance(ctorArgs);
      // _category.debug(obj.getClass().getName() + ": " + obj.toString());
    } catch (NoSuchMethodException e) {
      throw new DeserializerException("no ctor(String) found for class: "
          + _wrapperType.getName());
    } catch (java.lang.reflect.InvocationTargetException e) {
      throw new DeserializerException("exception in initializer: "
          + e.getMessage());
    } catch (IllegalAccessException e) {
      throw new DeserializerException("can't access ctor(String) for class: "
          + _wrapperType.getName());
    } catch (InstantiationException e) {
      throw new DeserializerException("can't instantiate class: "
          + _wrapperType.getName());
    }

    return obj;
  }
View Full Code Here

   */
  public void setMember(Object parent, String name, Object value)
      throws DeserializerException {

    // not allowed with primitive type
    throw new DeserializerException(
        "no child element allowed for primitive type");
  }
View Full Code Here

      }
      else if (name.equals("value")) {
        mapHelper.setValue(value);
      }
      else {
        throw new DeserializerException(
          "element key or value expected as child of mapentry");
      }
    }
    catch (ClassCastException e) {
      throw new DeserializerException(
        "invalid sequence: Map.Entry expected, but was: "
          + parent.getClass().getName());
    }

  }
View Full Code Here

TOP

Related Classes of com.skaringa.javaxml.DeserializerException

Copyright © 2018 www.massapicom. 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.