Interface MethodLink

All Superinterfaces:
Identifiable, Link, Stringifiable, WithModifiers, WithName, WithType, WithTypeList
All Known Implementing Classes:
BasicMethodLink

public interface MethodLink extends WithModifiers, WithName, WithType, WithTypeList, Identifiable

An interface used to simply access methods.

  • Nested Class Summary

    Link.Kind
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> T
    invoke(Object instance, Object... arguments)
    Invokes the method linked by this method link on the given instance with the given arguments.
    <T> T
    invokeStatic(Object... arguments)
    Invokes the method linked by this method link with the given arguments.
    default Link.Kind
     
    default int
    Return the bit representation of the modifiers of this link.
    default String
    Returns the name of this link.
    Returns the actual method behind this method link.
    Returns the return type of the method linked by this method link.

    Methods inherited from interface org.tudalgo.algoutils.tutor.general.match.Identifiable

    string

    Methods inherited from interface org.tudalgo.algoutils.tutor.general.reflections.WithName

    identifier

    Methods inherited from interface org.tudalgo.algoutils.tutor.general.reflections.WithType

    type

    Methods inherited from interface org.tudalgo.algoutils.tutor.general.reflections.WithTypeList

    typeList
  • Method Details

    • returnType

      TypeLink returnType()

      Returns the return type of the method linked by this method link.

      Returns:
      the return type
    • invoke

      <T> T invoke(Object instance, Object... arguments) throws Exception

      Invokes the method linked by this method link on the given instance with the given arguments.

      Type Parameters:
      T - the type of the return value
      Parameters:
      instance - the instance
      arguments - the arguments
      Returns:
      the return value
      Throws:
      Exception
    • invokeStatic

      <T> T invokeStatic(Object... arguments) throws Exception

      Invokes the method linked by this method link with the given arguments.

      Type Parameters:
      T - the type of the return value
      Parameters:
      arguments - the arguments
      Returns:
      the return value
      Throws:
      Exception
    • kind

      default Link.Kind kind()
      Specified by:
      kind in interface Link
    • reflection

      Method reflection()
      Returns the actual method behind this method link.
      Specified by:
      reflection in interface Link
      Returns:
      the method
    • name

      default String name()
      Description copied from interface: WithName

      Returns the name of this link.

      Specified by:
      name in interface WithName
      Returns:
      the name
    • modifiers

      default int modifiers()
      Description copied from interface: WithModifiers

      Return the bit representation of the modifiers of this link.

      Specified by:
      modifiers in interface WithModifiers
      Returns:
      the modifiers