Class ClassViewModel


  • public class ClassViewModel
    extends ProcessableViewModel
    This utility class renders Clazz objects into a more human-readable format. It can be used as a Java type renderer in Intellij-based IDE to support debugging.
    • Method Detail

      • render

        public static ClassViewModel render​(Clazz clazz)
        Renders Clazz object into an abstract representation that hides the low-level Jvm class data structure. The processing flags rendering are limited to those declared in ProcessingFlags.
        Parameters:
        clazz - The Clazz object to be rendered.
        Returns:
        A high-level representation of Clazz (i.e., ClassViewModel object).
      • render

        public static <T extends ProcessingFlagsClassViewModel render​(Clazz clazz,
                                                                        java.lang.Class<T> processingFlagsHolder)
        Renders Clazz object into an abstract representation that hides the low-level Jvm class data structure; additional processing flags declared in a subclass of ProcessingFlags will also be rendered.
        Parameters:
        clazz - The Clazz object to be rendered.
        processingFlagsHolder - A subclass of ProcessingFlags that holds additional processing flags.
        Returns:
        A high-level representation of Clazz (i.e., ClassViewModel object).
      • renderPreview

        public static java.lang.String renderPreview​(Clazz model)
        A utility method that renders a Clazz object into a string containing class name, type, accessibility. (e.g., "public static class Foo").
        Parameters:
        model - Clazz object to be rendered.
        Returns:
        A string previewing the class signature.
      • renderSuperClass

        public static ClassViewModel renderSuperClass​(Clazz model)
        A utility method for recursively rendering Clazz objects in the hierarchy.
        Parameters:
        model - A Clazz object whose parent needs to be rendered.
        Returns:
        A high-level representation of the parent Clazz.
      • renderInterfaces

        public static ClassViewModel[] renderInterfaces​(Clazz model)
        A utility method for recursively rendering interfaces of an implementing Clazz.
        Parameters:
        model - A Clazz object whose interfaces need to be rendered.
        Returns:
        An array of high-level representation of the implemented interfaces.
      • renderConstantPool

        public static ConstantViewModel[] renderConstantPool​(Clazz model)
        A utility method for rendering each constant pool entry into a higher-level representation. see ConstantViewModel.
        Parameters:
        model - A Clazz object whose constant pool needs to be rendered.
        Returns:
        An array of high-level representation of the constant pool entries.
      • renderFields

        public static FieldViewModel[] renderFields​(Clazz model)
        A utility method for rendering each Field into a higher-level representation. see FieldViewModel.
        Parameters:
        model - A Clazz object whose fields need to be rendered.
        Returns:
        An array of high-level representation of the class' fields.
      • renderMethods

        public static MethodViewModel[] renderMethods​(Clazz model)
        A utility method for rendering each Method into a higher-level representation. see MethodViewModel.
        Parameters:
        model - A Clazz object whose methods need to be rendered.
        Returns:
        An array of high-level representation of the class' methods.