Record Class NaftahFunction

java.lang.Object
java.lang.Record
org.daiitech.naftah.builtin.lang.NaftahFunction
Record Components:
name - the function name
useQualifiedName - flags that the function names should be bound with the provider's name
useQualifiedAliases - flags that the function aliases should be bound with the provider's name
aliases - function aliases, list of alternative function name
description - a brief description of the function
usage - usage information or signature of the function
returnType - the return type class of the function
parameterTypes - a list of classes representing the parameter types
exceptionTypes - a list of classes representing the exceptions the function may throw
All Implemented Interfaces:
Serializable

public record NaftahFunction(String name, boolean useQualifiedName, boolean useQualifiedAliases, String[] aliases, String description, String usage, Class<?> returnType, List<Class<?>> parameterTypes, List<Class<?>> exceptionTypes) extends Record implements Serializable
Represents a function definition in the Naftah scripting language.

This record holds metadata about a function, including its name, description, usage instructions, return type, parameter types, and declared exception types.

Author:
Chakib Daii
See Also:
  • Field Details

    • name

      private final String name
      The field for the name record component.
    • useQualifiedName

      private final boolean useQualifiedName
      The field for the useQualifiedName record component.
    • useQualifiedAliases

      private final boolean useQualifiedAliases
      The field for the useQualifiedAliases record component.
    • aliases

      private final String[] aliases
      The field for the aliases record component.
    • description

      private final String description
      The field for the description record component.
    • usage

      private final String usage
      The field for the usage record component.
    • returnType

      private final Class<?> returnType
      The field for the returnType record component.
    • parameterTypes

      private final List<Class<?>> parameterTypes
      The field for the parameterTypes record component.
    • exceptionTypes

      private final List<Class<?>> exceptionTypes
      The field for the exceptionTypes record component.
    • serialVersionUID

      private static final long serialVersionUID
      See Also:
  • Constructor Details

    • NaftahFunction

      public NaftahFunction(String name, boolean useQualifiedName, boolean useQualifiedAliases, String[] aliases, String description, String usage, Class<?> returnType, List<Class<?>> parameterTypes, List<Class<?>> exceptionTypes)
      Creates an instance of a NaftahFunction record class.
      Parameters:
      name - the value for the name record component
      useQualifiedName - the value for the useQualifiedName record component
      useQualifiedAliases - the value for the useQualifiedAliases record component
      aliases - the value for the aliases record component
      description - the value for the description record component
      usage - the value for the usage record component
      returnType - the value for the returnType record component
      parameterTypes - the value for the parameterTypes record component
      exceptionTypes - the value for the exceptionTypes record component
  • Method Details

    • of

      public static NaftahFunction of(String name, boolean useQualifiedName, boolean useQualifiedAliases, String[] aliases, String description, String usage, Class<?> returnType, Class<?>[] parameterTypes, Class<?>[] exceptionTypes)
      Factory method to create a NaftahFunction instance.
      Parameters:
      name - the function name
      useQualifiedName - flags that the function names should be bound with the provider's name
      useQualifiedAliases - flags that the function aliases should be bound with the provider's name
      description - a brief description of the function
      usage - usage information or signature of the function
      returnType - the return type class of the function
      parameterTypes - an array of parameter type classes
      exceptionTypes - an array of exception type classes
      Returns:
      a new NaftahFunction instance
    • toString

      public 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • name

      public String name()
      Returns the value of the name record component.
      Returns:
      the value of the name record component
    • useQualifiedName

      public boolean useQualifiedName()
      Returns the value of the useQualifiedName record component.
      Returns:
      the value of the useQualifiedName record component
    • useQualifiedAliases

      public boolean useQualifiedAliases()
      Returns the value of the useQualifiedAliases record component.
      Returns:
      the value of the useQualifiedAliases record component
    • aliases

      public String[] aliases()
      Returns the value of the aliases record component.
      Returns:
      the value of the aliases record component
    • description

      public String description()
      Returns the value of the description record component.
      Returns:
      the value of the description record component
    • usage

      public String usage()
      Returns the value of the usage record component.
      Returns:
      the value of the usage record component
    • returnType

      public Class<?> returnType()
      Returns the value of the returnType record component.
      Returns:
      the value of the returnType record component
    • parameterTypes

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

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