Class FieldSet

    • Constructor Detail

      • FieldSet

        public FieldSet​(AccessibleField field)
        Creates a setter Operation object for a field of a class. Throws an exception if the field is static final.
        Parameters:
        field - the field object to be set by setter statements
        Throws:
        IllegalArgumentException - if field is static final
    • Method Detail

      • appendCode

        public void appendCode​(Type declaringType,
                               TypeTuple inputTypes,
                               Type outputType,
                               List<Variable> inputVars,
                               StringBuilder b)
        Generates code for setting a field. Should look like
         field = value;
         
        or
         field = variable;
         
        Specified by:
        appendCode in class CallableOperation
        Parameters:
        inputVars - the list of input variables. Last element is value to assign. If an instance field, first is instance, second is value.
        b - the StringBuilder to which code is issued
        declaringType - the declaring type for this operation
        inputTypes - the input types for this operation
        outputType - the output type for this operation
      • toParsableString

        public String toParsableString​(Type declaringType,
                                       TypeTuple inputTypes,
                                       Type outputType)
        Returns the string descriptor for field that can be parsed by.
        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:
        the parsable string descriptor for this setter
      • parse

        public static TypedOperation parse​(String descr)
                                    throws OperationParseException
        Parses a description of a field setter in the given string. A setter description has the form "<set>( field-descriptor )" where "<set>" is literally what is expected.
        Parameters:
        descr - string containing descriptor of field setter
        Returns:
        the field setter for the given string descriptor
        Throws:
        OperationParseException - if descr does not have expected form
      • getName

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

        public int hashCode()
        Overrides:
        hashCode in class Object
      • isStatic

        public boolean isStatic()
        Description copied from interface: Operation
        Predicate to indicate whether object represents a static operation on the declaring class.
        Specified by:
        isStatic in interface Operation
        Overrides:
        isStatic in class CallableOperation
        Returns:
        true if operation corresponds to static method or field of a class, and false otherwise
      • isMessage

        public boolean isMessage()
        A FieldSetter is a method call because it acts like a setter.
        Specified by:
        isMessage in interface Operation
        Overrides:
        isMessage in class CallableOperation
        Returns:
        true if operation is method-like, and false otherwise