Record Class Invokers.Args

java.lang.Object
java.lang.Record
pro.verron.officestamper.core.Invokers.Args
Record Components:
sourceTypes - a list of parameter types representing the method's signature.
Enclosing class:
Invokers

public static record Invokers.Args(List<Class<?>> sourceTypes) extends Record

Represents argument types associated with method invocation.

This record encapsulates a list of parameter types and provides a method to validate whether a list of target types matches the source types.

The validation logic ensures that each target type is compatible with the corresponding source type. A type is compatible if it matches precisely or is assignable from the source type. Additionally, the Any class acts as a wildcard placeholder, making any type compatible.

  • Constructor Summary

    Constructors
    Constructor
    Description
    Args(List<Class<?>> sourceTypes)
    Creates an instance of a Args record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    Returns the value of the sourceTypes record component.
    final String
    Returns a string representation of this record class.
    boolean
    validate(List<Class> searchedTypes)
    Validates if the provided list of classes matches the source types according to the compatibility rules.

    Methods inherited from class Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • Args

      public Args(List<Class<?>> sourceTypes)
      Creates an instance of a Args record class.
      Parameters:
      sourceTypes - the value for the sourceTypes record component
  • Method Details

    • validate

      public boolean validate(List<Class> searchedTypes)
      Validates if the provided list of classes matches the source types according to the compatibility rules. A type is considered compatible if it matches precisely or is assignable from the corresponding source type. Additionally, the Any class serves as a wildcard, making any type compatible.
      Parameters:
      searchedTypes - the list of classes to validate against the source types.
      Returns:
      true if all the searched classes are compatible with the source types; false otherwise.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • sourceTypes

      public List<Class<?>> sourceTypes()
      Returns the value of the sourceTypes record component.
      Returns:
      the value of the sourceTypes record component