Class JInvocation

    • Field Detail

      • object

        private JGenerable object
        Object expression upon which this method will be invoked, or null if this is a constructor invocation
      • isConstructor

        private boolean isConstructor
      • args

        private java.util.List<JExpression> args
        List of argument expressions for this method invocation
      • type

        private JType type
        If isConstructor==true, this field keeps the type to be created.
    • Constructor Detail

      • JInvocation

        JInvocation​(JExpression object,
                    java.lang.String name)
        Invokes a method on an object.
        Parameters:
        object - JExpression for the object upon which the named method will be invoked, or null if none
        name - Name of method to invoke
      • JInvocation

        JInvocation​(JClass type,
                    java.lang.String name)
        Invokes a static method on a class.
      • JInvocation

        private JInvocation​(JGenerable object,
                            java.lang.String name)
      • JInvocation

        JInvocation​(JType c)
        Invokes a constructor of an object (i.e., creates a new object.)
        Parameters:
        c - Type of the object to be created. If this type is an array type, added arguments are treated as array initializer. Thus you can create an expression like new int[]{1,2,3,4,5}.
    • Method Detail

      • arg

        public JInvocation arg​(JExpression arg)
        Add an expression to this invocation's argument list
        Parameters:
        arg - Argument to add to argument list
      • arg

        public JInvocation arg​(java.lang.String v)
        Adds a literal argument. Short for arg(JExpr.lit(v))
      • listArgs

        public JExpression[] listArgs()
        Returns all arguments of the invocation.
        Returns:
        If there's no arguments, an empty array will be returned.