Class ReflectionArrayCreation

java.lang.Object
randoop.operation.CallableOperation
randoop.operation.ReflectionArrayCreation
All Implemented Interfaces:
Operation

public class ReflectionArrayCreation extends CallableOperation
Represents an array creation using reflection, and corresponds to the code (List<String>[])(Array.newInstance(componentType, length));
  • Field Details

    • elementType

      private final Type elementType
    • length

      private final int length
  • Constructor Details

    • ReflectionArrayCreation

      public ReflectionArrayCreation(ArrayType arrayType, int length)
  • Method Details

    • execute

      public ExecutionOutcome execute(Object[] input)
      Description copied from class: CallableOperation
      Performs this operation using the array of input values. Returns the results of execution as an ResultOrException object and can output results to specified PrintStream.
      Specified by:
      execute in class CallableOperation
      Parameters:
      input - array containing appropriate inputs to operation
      Returns:
      results of executing this statement
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • appendCode

      public void appendCode(Type declaringType, TypeTuple inputTypes, Type outputType, List<Variable> inputVars, StringBuilder b)
      Description copied from class: CallableOperation
      Produces a Java source code representation of this statement and appends it to the given StringBuilder.
      Specified by:
      appendCode in class CallableOperation
      Parameters:
      declaringType - the declaring type for this operation
      inputTypes - the input types for this operation
      outputType - the output type for this operation
      inputVars - the list of variables that are inputs to operation
      b - the StringBuilder to which code is added
    • toParsableString

      public String toParsableString(Type declaringType, TypeTuple inputTypes, Type outputType)
      Description copied from class: CallableOperation
      Returns a string representation of this Operation, which can be read by static parse method for class. For a class C implementing the Operation interface, this method should return a String s such that parsing the string returns an object equivalent to this object, i.e. C.parse(this.s).equals(this).
      Specified by:
      toParsableString in class CallableOperation
      Parameters:
      declaringType - the declaring type for this operation
      inputTypes - the input types for this operation
      outputType - the output type for this operation
      Returns:
      a string representation of this operation
    • getName

      public String getName()
      Description copied from interface: Operation
      Returns the name for the operation.
      Returns:
      the name for this operation