AidlAnnotation::ParamValue() to retrieve param's value

Similar to AnnotationParams() which returns a map<string, string> with
all params and their stringified values. Even though this is useful when
we pass them to generated Java code, it's not when the AIDL compiler
needs to process annotations.

ParamValue(param_name) looks up the parameter and returns the typed
value.

Bug: none
Test: aidl_unittests
Change-Id: I99aa8e6c0fd787350b02d3e84b642e387d41a40e
diff --git a/aidl_language.h b/aidl_language.h
index 7b6de2a..9bcbaa9 100644
--- a/aidl_language.h
+++ b/aidl_language.h
@@ -192,6 +192,9 @@
   // e.g) "@RustDerive(Clone=true, Copy=true)"
   string ToString() const;
 
+  template <typename T>
+  std::optional<T> ParamValue(const std::string& param_name) const;
+
   std::map<std::string, std::string> AnnotationParams(
       const ConstantValueDecorator& decorator) const;
   const string& GetComments() const { return comments_; }
@@ -1092,3 +1095,12 @@
   const std::vector<std::unique_ptr<AidlImport>> imports_;
   const std::vector<std::unique_ptr<AidlDefinedType>> defined_types_;
 };
+
+template <typename T>
+std::optional<T> AidlAnnotation::ParamValue(const std::string& param_name) const {
+  auto it = parameters_.find(param_name);
+  if (it == parameters_.end()) {
+    return std::nullopt;
+  }
+  return it->second->Cast<T>();
+}
\ No newline at end of file