Debug tool class

xiaoxiao2021-03-06  17

Import java.io. *; import java.util. *; import java.text. *; import java.lang.reflect. *;

/ ** * Debug tool class. This class provides two main static methods: *

  1. Myassert (Boolean condition); assertion, it is used to ensure that the conditions should be established, prevent * error spread. *
  2. dump (any data type, recursive depth); output a variable content, the latter parameter is saved, * The default is 3. This method can output content of any data type, including basic data type, number * group, and object. For some common objects, such as Vector, etc., there are specialized output formats. Other objects will output their * member variables, including private variables and static variables. The output process will be recursively, and the recursive level is controlled by the deep parameter *. If the recursive level exceeds the limit value, the contents of TOString () are output directly. If the recursive * cycle, the recurrent reference is discovered to stop recursive. Output Information In addition to the content of the object, the output time, * call the code where the DUMP function is located, the line number, if the object also includes the address of the object (Note: virtual * internal addressing, non-physical address, can be used to determine Is the two variables are referenced by the same object). * This class does not reference other classes, which can be compiled separately. This class is for debugging only, not performing performance optimization. * @Author sunlen * @version 1.0 * / public class debug {

    / ** * Construction method is private, prohibited from instantiation. * / Private debug () {}

    / **

    Ayuan

    9CBS certified blog expert

    Blog expert

    Huawei old employees

    Big Data

    More than ten years, in Huawei, Internet Corporation's experience, profound understanding and practical experience in CRM, big data, mainly sharing various project experience, including architecture, Java, big data and other articles

转载请注明原文地址:https://www.9cbs.com/read-44777.html

New Post(0)