Ejemplo n.º 1
0
 /**
  * Writes the object-graph containing values (primitives and wrappers), objects, and arrays,
  * starting from the given <code>o</code> node.
  *
  * @param o the write start-point node
  * @throws IllegalArgumentException if an illegal (non values/bean/array) is encountered
  */
 public final void write(Object o) {
   this.ensureRootWritten();
   try {
     this.write0(o);
   } catch (NoSuchMethodException nDC) {
     throw new IllegalArgumentException("o: no default constructor: " + nDC.getMessage(), nDC);
   } catch (InvocationTargetException | InstantiationException iDC) {
     throw new IllegalArgumentException(
         "o: invalid default constructor: " + iDC.getMessage(), iDC);
   } catch (IllegalAccessException iDCM) {
     throw new IllegalArgumentException(
         "o: invalid default constructor modifier: " + iDCM.getMessage(), iDCM);
   }
 }
Ejemplo n.º 2
0
 /**
  * Writes the given object recursively.
  *
  * @param o to write
  */
 @Override
 public final void write(Object o) {
   if (this.state != Driver.STATE_START && this.state != Driver.STATE_VALUE) {
     throw new IllegalStateException("cannot write o");
   }
   try {
     this.target.write0(o);
   } catch (NoSuchMethodException nDC) {
     throw new IllegalArgumentException(
         "value: no default constructor: " + nDC.getMessage(), nDC);
   } catch (InvocationTargetException | InstantiationException iDC) {
     throw new IllegalArgumentException(
         "value: invalid default constructor: " + iDC.getMessage(), iDC);
   } catch (IllegalAccessException iDCM) {
     throw new IllegalArgumentException(
         "value: invalid default constructor modifier: " + iDCM.getMessage(), iDCM);
   }
 }