This method is called when the template outputs data. This
implementation calls this.toString(Object) on the object and then
appends the result to the internal CharToByteBuffer.

@param obj the object to output

@hidden
506455
public final void print(Object obj) throws Exception {
        if ((mOutputOverridePermitted || mBuffer == null) 
            && mOutputReceiver != null) { 
            mOutputReceiver.print(obj);
        }
        else if (mBuffer != null) {
            mBuffer.append(toString(obj));
        }
    }
1220539
public void setControlValue(Object objValue)
    {
        boolean bDisplayData = (m_converter.getData() != objValue); // Displaying the same value will cause an endless loop

        boolean isModified = false;
        if (m_converter.getField() != null)
            isModified = m_converter.getField().isModified();
        m_converter.setData(objValue, bDisplayData, Constants.READ_MOVE);    // DO NOT! Display (will loop)
        String strDate = m_converter.toString();    // Get it in string format.
        m_converter.setString(strDate, false, Constants.READ_MOVE); // This validates the date
        if (m_converter.getField() != null)
            m_converter.getField().setModified(isModified);
        m_tf.setText(m_converter.toString());
    }
600820
public static String toJson(Object obj) {
		ObjectMapper mapper = new ObjectMapper();
		try {
			return mapper.writeValueAsString(obj);
		} catch (IOException e) {
			JK.throww(e);
			return null;
		}
	}
648942
public void finishMapJson(final Object... objs) {
        this.contentType = this.jsonContentType;
        if (this.recycleListener != null) this.output = objs;
        finish(request.getJsonConvert().convertMapTo(getBodyBufferSupplier(), objs));
    }
961658
@Override
    public void writeObject(Object obj, AbstractHessianOutput out)
        throws IOException
    {
        if (out.addRef(obj)) {
            return;
        }

        int ref = out.writeObjectBegin(getClassName(obj));

        if (ref < -1) {
            out.writeString("value");

            InputStream is = null;

            try {
                is = getInputStream(obj);
            } catch (Exception e) {
                log.log(Level.WARNING, e.toString(), e);
            }

            if (is != null) {
                try {
                    out.writeByteStream(is);
                } finally {
                    is.close();
                }
            } else {
                out.writeNull();
            }

            out.writeMapEnd();
        }
        else {
            if (ref == -1) {
                out.writeClassFieldLength(1);
                out.writeString("value");

                out.writeObjectBegin(getClassName(obj));
            }

            InputStream is = null;

            try {
                is = getInputStream(obj);
            } catch (Exception e) {
                log.log(Level.WARNING, e.toString(), e);
            }

            try {
                if (is != null)
                    out.writeByteStream(is);
                else
                    out.writeNull();
            } finally {
                if (is != null)
                    is.close();
            }
        }
    }
686823
public String serialize(T obj) {
        try {
            Marshaller marshaller = context.createMarshaller();
            marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
            StringWriter writer = new StringWriter();
            marshaller.marshal(obj, writer);
            return writer.toString();
        } catch (JAXBException e) {
            throw new XmlSerializationException("Exception encountered " +
                                                "serializing report: " +
                                                getErrorMsg(e), e);
        }
    }
533055
private void writeObject(ObjectOutputStream out) throws IOException {
		out.defaultWriteObject();

		final int size = dataSet.size();
		out.writeInt(size);

		if (size > 0) {
			DataOutputViewStreamWrapper wrapper = new DataOutputViewStreamWrapper(out);
			for (T element : dataSet){
				serializer.serialize(element, wrapper);
			}
		}
	}
351260
public static String toJson(Object obj) {
		try {
			return objectMapper.writeValueAsString(obj);
		} catch (JsonProcessingException e) {
			throw new RuntimeException(e);
		}
	}
728167
public String from(Object obj) {
                StringBuilder sb = new StringBuilder(str);
                Method[] methods = obj.getClass().getMethods();
                Field[] fields = obj.getClass().getDeclaredFields();
                int lastIndex = -1;
                out:
                while (true) {
                        int start = sb.indexOf("${", lastIndex) + 2;
                        if (start == 1) {
                                break;
                        }
                        int end = sb.indexOf("}", start);
                        if (end == -1 || start == end) {
                                break;
                        }
                        String name = sb.substring(start, end);
                        // check functional methods
                        for (Method m : methods) {
                                String mName = m.getName();
                                if (m.getParameterTypes().length == 0 && m.getReturnType() != Void.TYPE && mName.equals(name)) {
                                        m.setAccessible(true);
                                        try {
                                                sb.replace(start - 2, end + 1, m.invoke(obj, new Object[0]).toString());
                                        } catch (Exception e) {
                                                throw $(e);
                                        }
                                        lastIndex = end;
                                        continue out;
                                }
                        }
                        // check getter
                        for (Method m : methods) {
                                String mName = m.getName();
                                if (m.getParameterTypes().length == 0 && m.getReturnType() != Void.TYPE
                                        && mName.equals("get" + name.substring(0, 1).toUpperCase() + name.substring(1))) {
                                        m.setAccessible(true);
                                        try {
                                                sb.replace(start - 2, end + 1, m.invoke(obj, new Object[0]).toString());
                                        } catch (Exception e) {
                                                throw $(e);
                                        }
                                        lastIndex = end;
                                        continue out;
                                }
                        }
                        // check field
                        for (Field f : fields) {
                                if (f.getName().equals(name)) {
                                        f.setAccessible(true);
                                        try {
                                                sb.replace(start - 2, end + 1, f.get(obj).toString());
                                        } catch (Exception e) {
                                                throw $(e);
                                        }
                                        lastIndex = end;
                                        continue out;
                                }
                        }
                        lastIndex = end;
                }
                str = sb.toString();
                return str;
        }
512307
public void finishJson(final JsonConvert convert, final Object obj) {
        this.contentType = this.jsonContentType;
        if (this.recycleListener != null) this.output = obj;
        finish(convert.convertTo(getBodyBufferSupplier(), obj));
    }
859593
public static int serialize(OutputStream stream, Object obj) {
        ObjectMapper mapper = createMapperWithJaxbAnnotationInspector();

        try (DataOutputStream data = new DataOutputStream(stream);
             OutputStreamWriter writer = new OutputStreamWriter(data, StandardCharsets.UTF_8)) {
            mapper.writerWithDefaultPrettyPrinter().writeValue(writer, obj);
            return data.size();
        } catch (IOException e) {
            throw new ReportGenerationException(e);
        }
    }
1088163
@Override
    public void visitCode(final Code obj) {
        if (sourceLines == null) {
            return;
        }

        if (isAbstract) {
            return;
        }

        if (Values.STATIC_INITIALIZER.equals(methodName) || Values.CONSTRUCTOR.equals(methodName)) {
            return;
        }

        int methodStart = srcLineAnnotation.getStartLine() - 2;
        int methodLine = methodStart;
        String line;
        while ((methodLine >= 0) && (methodLine < sourceLines.length)) {
            line = sourceLines[methodLine];
            if (line.indexOf(methodName) >= 0) {
                break;
            }
            methodLine--;
        }

        if (methodLine < 0) {
            return;
        }

        for (int i = methodLine; i <= methodStart; i++) {
            if ((i < 0) || (i >= sourceLines.length)) {
                return;
            }
            line = sourceLines[i];
            if (line.indexOf("final") >= 0) {
                return;
            }
        }

        changedParms = new BitSet();
        super.visitCode(obj);

        BugInstance bi = null;
        for (int i = 0; i < firstLocalReg; i++) {
            if (changedParms.get(i)) {
                changedParms.clear(i);
                continue;
            }

            String parmName = getRegisterName(obj, i);
            if (bi == null) {
                bi = new BugInstance(this, BugType.FP_FINAL_PARAMETERS.name(), LOW_PRIORITY).addClass(this).addMethod(this).addSourceLine(this, 0);
                bugReporter.reportBug(bi);
            }
            bi.addString(parmName);
        }
        changedParms = null;
    }
801696
public static String parametersToString(Object... objs) {
    StringBuilder sb = new StringBuilder("(");
    if (objs != null) {
      for (int k = 0; k < objs.length; k++) {
        if (k != 0) {
          sb.append(", ");
        }
        if (objs[k] == null) {
          sb.append("null");
        } else {
          sb.append(objs[k].toString());
        }
      }
    }
    sb.append(")");
    return sb.toString();
  }
1319471
public void publish(Object obj) {
        try {
            if (_isBatch) {
                publishBatch(obj);
            } else {
                publish(obj, true);
            }
        } catch (InsufficientCapacityException ex) {
            throw new RuntimeException("This code should be unreachable!");
        }
    }
517406
private void render(SVG.Rect obj)
   {
      debug("Rect render");

      if (obj.width == null || obj.height == null || obj.width.isZero() || obj.height.isZero())
         return;

      updateStyleForElement(state, obj);

      if (!display())
         return;
      if (!visible())
         return;

      if (obj.transform != null)
         canvas.concat(obj.transform);

      Path  path = makePathAndBoundingBox(obj);
      updateParentBoundingBox(obj);

      checkForGradientsAndPatterns(obj);
      checkForClipPath(obj);

      boolean  compositing = pushLayer();

      if (state.hasFill)
         doFilledPath(obj, path);
      if (state.hasStroke)
         doStroke(path);


      if (compositing)
         popLayer(obj);
   }
355114
public String objectToString(Object obj)
    {
        String string = super.objectToString(obj);
        string = Base64.encode(string);
        return string;
    }
1109225
private static void serializeObject(final Object obj, final ContentHandler handler) throws SAXException {
    if (obj instanceof Map) {
      serializeMap((Map) obj, handler);
    } else if (obj instanceof List) {
      serializeList((List) obj, handler);
    } else if (obj instanceof Number) {
      if (obj instanceof Double || obj instanceof Float) {
        serializeReal((Number) obj, handler);
      } else {
        serializeInteger((Number) obj, handler);
      }
    } else if (obj instanceof Boolean) {
      serializeBoolean((Boolean) obj, handler);
    } else {
      serializeString(String.valueOf(obj), handler);
    }
  }