Class SuggestionLookup
This class acts as an adapter between the class-level suggestion model
returned by the AI subsystem (AiClassSuggestion) and the per-method
processing logic used by MethodAtlasApp. It converts the list of
AiMethodSuggestion objects into a name-indexed lookup map so that
suggestions can be retrieved in constant time during traversal of parsed test
methods.
Design Characteristics
- immutable after construction
- null-safe for missing or malformed AI responses
- optimized for repeated method-level lookups
If the AI response contains duplicate suggestions for the same method, only the first occurrence is retained.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionRetrieves the AI suggestion for the specified method name.static SuggestionLookupfrom(AiClassSuggestion suggestion) Creates a lookup instance from a class-level AI suggestion result.
-
Method Details
-
from
Creates a lookup instance from a class-level AI suggestion result.The method extracts all method suggestions contained in the supplied
AiClassSuggestionand indexes them by method name. Entries withnullsuggestions, missing method names, or blank method names are ignored.If the suggestion contains no method entries, an empty lookup instance is returned.
- Parameters:
suggestion- AI classification result for a test class- Returns:
- lookup structure providing fast access to method suggestions
-
find
Retrieves the AI suggestion for the specified method name.If no suggestion exists for the method, an empty
Optionalis returned.- Parameters:
methodName- name of the method being queried- Returns:
- optional containing the suggestion if present
- Throws:
NullPointerException- ifmethodNameisnull
-