Class Callable

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    Constructor, Method

    public abstract class Callable
    extends Declaration
    implements java.io.Serializable
    Callable - Documentation.

    This class is abstract and is simply used to represent either a method, or a constructor - both of which can be 'called' by a line of java code. All Callable's have a few things in common, a parameter list, and exception throw list, and a name. Rather than re-write the code that can deal with / handle a list of parameters (their names and types), this abstract class has a few methods for handling these features, and then both class Constructor, and class Method may 're-use' the parameter-list handling code in their own definitions.

    There is a Java-Parser Library that is required to use this Package. The Java Doc Upgrader Package / Tool will not work without this '.jar'file being placed in your CLASSPATH environment-variable. That '.jar'is available here:

    http://developer.torello.directory/ralphsReference/jars/javaparser-core-3.16.2.jar

    There is a book available and an internet "Gitter" support web-site chat-room with some of the people involved in writing this library. There are quite a number of available jars in the "Master Jar Distribution" - but the core library jar is fully sufficient for running the tasks needed by this Java-Doc Upgrade Tool's logic.
    See Also:
    Serialized Form



    • Field Detail

      • serialVersionUID

        public static final long serialVersionUID
        This fulfils the SerialVersion UID requirement for all classes that implement Java's interface java.io.Serializable. Using the Serializable Implementation offered by java is very easy, and can make saving program state when debugging a lot easier. It can also be used in place of more complicated systems like "hibernate" to store data as well.
        See Also:
        Constant Field Values
        Code:
        Exact Field Declaration Expression:
        1
        public static final long serialVersionUID = 1;
        
      • body

        public final java.lang.String body
        The body of the Callable. This is information that only the Java-Parser (library-JAR) can retrieve. The Java Reflection Library has no ability whatsoever to return information about the actual text that a programmer typed into his java source file. Generally, such information is not of much use; however, in order to implement an improvement on utilities such as this javadoc upgrader utility, this information can be invaluable.
        Code:
        Exact Field Declaration Expression:
        1
        public final String body;
        
      • parameterNames

        protected final java.lang.String[] parameterNames
        The names of all parameters to this Method or Constructor. This array must be considered as a parallel array to the other arrays, 'parameterTypes' and 'parameterTypesNoPackage'.
        Code:
        Exact Field Declaration Expression:
        1
        protected final String[] parameterNames;
        
      • parameterTypes

        protected final java.lang.String[] parameterTypes
        The types of all parameters to this Method or Constructor.

        NOTE: The parsed-types for a Method or Constructor signature often, but not always include the full-package name of the classes (and interfaces) for input-parameters that were not primitive-types. This abstract class 'DeclWithParameter' does not fill-out the full package name for a class/interface itself. The "full-package name" for an input parameter to a Method or Constructor is provided (sometimes, but not always) by the underlying Java-Parser mechanism. If the Java-Parser external JAR library does not provide full-package class-names, such information is just assumed unavailable.

        This array must be considered as a parallel array to the other arrays, 'parameterNames' and 'parameterTypesNoPackage'.
        Code:
        Exact Field Declaration Expression:
        1
        protected final String[] parameterTypes;
        
      • parameterTypesNoPackage

        protected final java.lang.String[] parameterTypesNoPackage
        The types of all parameters to this Method or Constructor. The parsed types of a signature often, but not always include the full-package name of the classes and interfaces for the type. This protected final String[] contains identical information as the protected final String[] 'parameterTypes', but differs in that - if any of the class or interface names included the java 'full package identifier' (for instance: java.lang.String, instead of just 'String') - then that package information will already have been "stripped out" of the String.

        ALSO: This array must be considered as a parallel array to the other arrays, 'parameterNames' and 'parameterTypes'.
        Code:
        Exact Field Declaration Expression:
        1
        protected final String[] parameterTypesNoPackage;
        
      • exceptions

        protected final java.lang.String[] exceptions
        The names of all Exception, Error and Throwable that may be thrown by this Constructor or Method.
        Code:
        Exact Field Declaration Expression:
        1
        protected final String[] exceptions;
        
    • Constructor Detail

      • Callable

        protected Callable​
                    (java.lang.String[] modifiers,
                     java.lang.String name,
                     java.lang.String signature,
                     java.lang.String jdComment,
                     com.github.javaparser.ast.NodeList<com.github.javaparser.ast.body.Parameter> paramList,
                     java.lang.String body,
                     com.github.javaparser.ast.NodeList<com.github.javaparser.ast.type.ReferenceType> exceptions)
        
        Internally Used Constructor. Subclasses that inherit this abstract class use this.
      • Callable

        protected Callable​(java.lang.String[] modifiers,
                           java.lang.String name,
                           java.lang.String signature,
                           java.lang.String jdComment,
                           java.lang.String[] parameterNames,
                           java.lang.String[] parameterTypes,
                           java.lang.String[] parameterTypesNoPackage,
                           java.lang.String[] exceptions,
                           java.lang.String body)
        Internally Used. Useful for the clone() method
    • Method Detail

      • getParameterNames

        public java.lang.String[] getParameterNames()
        Retrieves the list of parameterNames as a String[] array clone
        Returns:
        An instance of String[] that employs the clone() method of the internal data-structure, protecting its contents.
        Code:
        Exact Method Body:
        1
         return parameterNames.clone();
        
      • getParameterNames

        public void getParameterNames​
                    (java.util.function.Consumer<java.lang.String> acceptParamNameAsStringConsumer)
        
        Retrieves the list of parameterNames using a 'java.util.function.Consumer<String>', so that any data-structure needed can be used to retrieve these parameters.
        Parameters:
        acceptParamNameAsStringConsumer - This java.util.function.Consumer should accept type String, and be used to fill a data-structure of whatever type is needed with the parameterNames associated with 'this' Method or Constructor

        • decl.getParameterNames(ts::add); - Inserts the list of parameterNames into a 'TreeSet', assuming variable 'ts' was of type TreeSet<String>

        • decl.getParameterNames(v::add); - Inserts the list of parameterNames into a 'Vector', assuming the variable 'v' was of type Vector<String>

        Code:
        Exact Method Body:
        1
        2
         for (String parameterName : parameterNames)
             acceptParamNameAsStringConsumer.accept(parameterName);
        
      • getParameterTypes

        public java.lang.String[] getParameterTypes()
        Retrieves the list of parameterTypes as a String[] array.
        Returns:
        An instance of String[] that employs the clone() method of the internal data-structure, protecting its contents
        Code:
        Exact Method Body:
        1
         return parameterTypes.clone();
        
      • getParameterTypes

        public void getParameterTypes​
                    (java.util.function.Consumer<java.lang.String> acceptParamTypeAsStringConsumer)
        
        Retrieves the list of parameterTypes using a 'java.util.function.Consumer<String>', so that any data-structure needed can be used to retrieve this parameters.
        Parameters:
        acceptParamTypeAsStringConsumer - This java.util.function.Consumer should accept type String, and be used to fill a data-structure of whatever type is needed with the parameter-types associated with 'this' Method or Constructor.

        • decl.getParameterTypes(ts::add); - Inserts the list of parameterTypes into a 'TreeSet', assuming variable 'ts' was of type TreeSet<String>

        • decl.getParameterTypes(v::add) - Inserts the list of parameterTypes into a 'Vector', assuming the variable 'v' was of type Vector<String>
        Code:
        Exact Method Body:
        1
        2
         for (String parameterType : parameterTypes)
             acceptParamTypeAsStringConsumer.accept(parameterType);
        
      • getParameterTypesWithoutPackageInfo

        public java.lang.String[] getParameterTypesWithoutPackageInfo()
        Retrieves the list of parameterTypes as a String[] array. The String's that are returned from this method are the ones stored internally to the String-array 'parameterTypesNoPackage'. They do not retain the package information (if they even had that information in the first place).
        Returns:
        An instance of String[] that employs the clone() method of the internal data-structure, protecting its contents
        Code:
        Exact Method Body:
        1
         return parameterTypesNoPackage.clone();
        
      • getParameterTypesWithoutPackageInfo

        public void getParameterTypesWithoutPackageInfo​
                    (java.util.function.Consumer<java.lang.String> acceptParamTypeAsStringConsumer)
        
        Retrieves the list of parameterTypes using a 'java.util.function.Consumer<String>', so that any data-structure needed can be used to retrieve this parameters. The String's that are sent to the Consumer are the ones stored internally to the String-array 'parameterTypesNoPackage'. They do not retain the package-information (if they even had that information in the first place).
        Parameters:
        acceptParamTypeAsStringConsumer - This java.util.function.Consumer should accept type String, and be used to fill a data-structure of whatever type is needed with the parameter-types associated with 'this' Method or Constructor.

        • decl.getParameterTypesWithoutPackageInfo(ts::add); - Inserts the list of parameter-no-package-types into a 'TreeSet', assuming variable 'ts' was of type TreeSet<String>

        • decl.getParameterTypesWithoutPackageInfo(v::add); - Inserts the list of parameter-no-package-types into a 'Vector', assuming the variable 'v' was of type Vector<String>
        Code:
        Exact Method Body:
        1
        2
         for (String parameterTypeNoPackage : parameterTypesNoPackage)
             acceptParamTypeAsStringConsumer.accept(parameterTypeNoPackage);
        
      • getExceptions

        public java.lang.String[] getExceptions()
        Retrieves the list of Exception's as a String[] array. The String's that are returned from this method are the ones stored internally to the String-array 'exceptions'.
        Returns:
        An instance of String[] that employs the clone() method of the internal data-structure, protecting its contents.
        Code:
        Exact Method Body:
        1
         return exceptions.clone();
        
      • getExceptions

        public void getExceptions​
                    (java.util.function.Consumer<java.lang.String> acceptExceptionsAsStringConsumer)
        
        Retrieves the list of exceptions using a 'java.util.function.Consumer<String>', so that any data-structure needed can be used to retrieve these Exception's. The String's that are sent to the Consumer are the ones stored internally to the String-array 'exceptions'.
        Parameters:
        acceptExceptionsAsStringConsumer - This java.util.function.Consumer should accept type String, and be used to fill a data-structure of whatever type is needed with the Exception's associated with 'this' Method or Constructor.

        • decl.getParameterTypesWithoutPackageInfo(ts::add); - Inserts the list of exceptions into a 'TreeSet', assuming variable 'ts' was of type TreeSet<String>

        • decl.getParameterTypesWithoutPackageInfo(v::add); Inserts the list of exceptions into a 'Vector', assuming the variable 'v' was of type Vector<String>
        Code:
        Exact Method Body:
        1
        2
         for (String exception : exceptions)
             acceptExceptionsAsStringConsumer.accept(exception);