All Downloads are FREE. Search and download functionalities are using the official Maven repository.

flex.messaging.util.BasicPrettyPrinter Maven / Gradle / Ivy

Go to download

BlazeDS is the server-based Java remoting and web messaging technology that enables developers to easily connect to back-end distributed data and push data in real-time to Adobe Flex and Adobe AIR applications for more responsive rich Internet application (RIA) experiences.

There is a newer version: 3.2.0.3978
Show newest version
/*************************************************************************
 *
 * ADOBE CONFIDENTIAL
 * __________________
 *
 *  [2002] - [2007] Adobe Systems Incorporated
 *  All Rights Reserved.
 *
 * NOTICE:  All information contained herein is, and remains
 * the property of Adobe Systems Incorporated and its suppliers,
 * if any.  The intellectual and technical concepts contained
 * herein are proprietary to Adobe Systems Incorporated
 * and its suppliers and may be covered by U.S. and Foreign Patents,
 * patents in process, and are protected by trade secret or copyright law.
 * Dissemination of this information or reproduction of this material
 * is strictly forbidden unless prior written permission is obtained
 * from Adobe Systems Incorporated.
 */
package flex.messaging.util;

import java.lang.reflect.Array;
import java.lang.reflect.Method;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.Map;

/**
 * Prettifies the representation of an Object as a String. Complex
 * types are not traversed.
 */
public class BasicPrettyPrinter implements PrettyPrinter, Cloneable
{
    protected ObjectTrace trace;
    
    public BasicPrettyPrinter()
    {
    }

    /**
     * Prettifies the representation of an Object as a String.
     * 
    *
  • Simple types are simply toString'ed.
  • *
  • XML strings are formatted with line feeds and indentations.
  • *
  • Complex types report their class names.
  • *
  • Collections, Maps and native Arrays also report their size/length.
  • *
* @return A prettified version of an Object as a String. */ public String prettify(Object o) { try { trace = new ObjectTrace(); internalPrettify(o); return trace.toString(); } catch (Throwable t) { return trace.toString(); } finally { trace = null; } } protected void internalPrettify(Object o) { if (o == null) { trace.writeNull(); } else if (o instanceof String) { String string = (String)o; if (string.startsWith("




© 2015 - 2025 Weber Informatics LLC | Privacy Policy