Package org.daiitech.naftah.builtin
Annotation Interface NaftahFn
Annotation to mark a method as a Naftah built-in function.
This annotation provides metadata about the function, including its name, description, usage, return type, parameter types, and exceptions it may throw.
مثال على الاستخدام:
@NaftahFn(
name = "جمع",
description = "يحسب مجموع رقمين",
usage = "جمع(int أ, int ب)",
returnType = int.class,
parameterTypes = {int.class, int.class},
exceptionTypes = {}
)
public int جمع(int أ, int ب) { ... }
- Author:
- Chakib Daii
-
Required Element Summary
Required Elements -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionString[]Alternative names (aliases) by which the function may also be referenced.Class<?>[]The array of exception type classes that the function may throw.Class<?>[]The array of parameter type classes accepted by the function.Class<?>The return type class of the function.booleanflags that the function aliases should be bound with the provider's name.booleanflags that the function names should be bound with the provider's name.
-
Element Details
-
name
String nameThe function name as exposed to the Naftah environment.- Returns:
- the function name
-
description
String descriptionA brief description of what the function does.- Returns:
- the function description
-
usage
String usageThe usage string or signature for the function.- Returns:
- the usage information
-
-
-
useQualifiedName
boolean useQualifiedNameflags that the function names should be bound with the provider's name.- Returns:
- true if we should use qualified name; false if not
- Default:
- false
-
useQualifiedAliases
boolean useQualifiedAliasesflags that the function aliases should be bound with the provider's name.- Returns:
- true if we should use qualified name; false if not
- Default:
- false
-
aliases
String[] aliasesAlternative names (aliases) by which the function may also be referenced.Aliases can be used to access the same function under different identifiers, typically for backwards compatibility or syntactic sugar.
- Returns:
- an array of alias names, or an empty array if none
- Default:
- {}
-
returnType
Class<?> returnTypeThe return type class of the function. Defaults toVoid.classif no return value.- Returns:
- the return type class
- Default:
- java.lang.Void.class
-
parameterTypes
Class<?>[] parameterTypesThe array of parameter type classes accepted by the function.- Returns:
- array of parameter types
- Default:
- {}
-
exceptionTypes
Class<?>[] exceptionTypesThe array of exception type classes that the function may throw.- Returns:
- array of exception types
- Default:
- {}
-