Package com.tnsai.metadata
Class ParamSpec
java.lang.Object
com.tnsai.metadata.ParamSpec
Immutable metadata about a method parameter.
Extracted from method signature and annotations via reflection.
Following ADR-006: Immutable Models
- Thread-safe by design
- All fields final
- No setters
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGets the fully qualified type name.Gets the simple type name (without package).booleanChecks if this parameter has a default value.booleanChecks if this parameter has a description.booleanChecks if the parameter type is numeric (primitive or wrapper).booleanChecks if the parameter type is primitive.booleanisString()Checks if the parameter type is a String.Creates a formatted string for prompt generation.
-
Constructor Details
-
ParamSpec
public ParamSpec(String name, Class<?> type, boolean optional, String defaultValue, String description, int position) Creates parameter metadata.- Parameters:
name- parameter name (from method signature)type- parameter type (from method signature)optional- whether parameter is optional (from @Optional annotation)defaultValue- default value if optional (from @Optional annotation)description- human-readable description (from @Description annotation)position- parameter position in method signature (0-based)
-
-
Method Details
-
getSimpleTypeName
Gets the simple type name (without package).- Returns:
- simple type name
-
getFullTypeName
Gets the fully qualified type name.- Returns:
- fully qualified type name
-
hasDescription
public boolean hasDescription()Checks if this parameter has a description.- Returns:
- true if description is not empty
-
hasDefaultValue
public boolean hasDefaultValue()Checks if this parameter has a default value.- Returns:
- true if default value is not empty
-
isPrimitive
public boolean isPrimitive()Checks if the parameter type is primitive.- Returns:
- true if type is primitive
-
isString
public boolean isString()Checks if the parameter type is a String.- Returns:
- true if type is String
-
isNumeric
public boolean isNumeric()Checks if the parameter type is numeric (primitive or wrapper).- Returns:
- true if type is numeric
-
toPromptString
Creates a formatted string for prompt generation. Format: "name: type (optional) - description"- Returns:
- formatted parameter string
-