summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBilal Alsharifi <bilal.alsharifi@gmail.com>2020-08-10 14:31:45 -0400
committerBilal Alsharifi <bilal.alsharifi@gmail.com>2020-08-10 14:31:45 -0400
commit74a15d7d3a803ce4b2fac21e6cd1e06fe20afeb4 (patch)
tree0127037ed3f1429f916f4a8feab256171502ad58
parent2bd191a01aa258837da59279b03800a3931f8cfa (diff)
downloadsdl_android-74a15d7d3a803ce4b2fac21e6cd1e06fe20afeb4.tar.gz
Add missing attributes to the generated javadoc
-rw-r--r--generator/templates/base_template.java2
-rw-r--r--generator/transformers/common_producer.py34
-rw-r--r--generator/transformers/functions_producer.py1
-rw-r--r--generator/transformers/structs_producer.py2
4 files changed, 37 insertions, 2 deletions
diff --git a/generator/templates/base_template.java b/generator/templates/base_template.java
index 0f1d58c95..ad5914ad6 100644
--- a/generator/templates/base_template.java
+++ b/generator/templates/base_template.java
@@ -53,6 +53,7 @@ import {{i}};{{ '\n' if loop.last }}
* <th>Type</th>
* <th>Description</th>
* <th>Required</th>
+ * <th>Notes</th>
* <th>Version Available</th>
* </tr>
{%- for param in params %}
@@ -61,6 +62,7 @@ import {{i}};{{ '\n' if loop.last }}
* <td>{{param.return_type}}</td>
* <td>{%- for d in param.description %}{{d}}{%- endfor %}</td>
* <td>{%- if param.mandatory is eq true %}Y{%- else %}N{%- endif %}</td>
+ * <td>{%- for k in param.values %}{{k}}: {{param.values[k]}}{{ '; ' if not loop.last }}{%- endfor %}</td>
* <td>{%- if param.since is defined %}SmartDeviceLink {{param.since}}{%- endif %}</td>
* </tr>
{%- endfor %}
diff --git a/generator/transformers/common_producer.py b/generator/transformers/common_producer.py
index ceb4b3cec..44bb07848 100644
--- a/generator/transformers/common_producer.py
+++ b/generator/transformers/common_producer.py
@@ -5,7 +5,7 @@ Common transformation
import logging
import re
from abc import ABC
-from collections import namedtuple
+from collections import namedtuple, OrderedDict
from model.array import Array
from model.enum import Enum
@@ -79,6 +79,38 @@ class InterfaceProducerCommon(ABC):
return re.sub(r'(\s{2,}|\n|\[@TODO.+)', ' ', ''.join(d)).strip() if d else ''
@staticmethod
+ def extract_values(param):
+ p = OrderedDict()
+ if hasattr(param.param_type, 'min_value'):
+ p['min_value'] = param.param_type.min_value
+ elif hasattr(param.param_type, 'element_type') and hasattr(param.param_type.element_type, 'min_value'):
+ p['min_value'] = param.param_type.element_type.min_value
+ if hasattr(param.param_type, 'max_value'):
+ p['max_value'] = param.param_type.max_value
+ elif hasattr(param.param_type, 'element_type') and hasattr(param.param_type.element_type, 'max_value'):
+ p['max_value'] = param.param_type.element_type.max_value
+ if hasattr(param, 'default_value'):
+ p['default_value'] = param.default_value
+ elif hasattr(param.param_type, 'default_value'):
+ p['default_value'] = param.param_type.default_value
+ if hasattr(param.param_type, 'min_length'):
+ p['min_length'] = param.param_type.min_length
+ elif hasattr(param.param_type, 'element_type') and hasattr(param.param_type.element_type, 'min_length'):
+ p['min_length'] = param.param_type.element_type.min_length
+ if hasattr(param.param_type, 'max_length'):
+ p['max_length'] = param.param_type.max_length
+ elif hasattr(param.param_type, 'element_type') and hasattr(param.param_type.element_type, 'max_length'):
+ p['max_length'] = param.param_type.element_type.max_length
+ if hasattr(param.param_type, 'min_size'):
+ p['min_size'] = param.param_type.min_size
+ if hasattr(param.param_type, 'max_size'):
+ p['max_size'] = param.param_type.max_size
+
+ # Filter None values
+ filtered_values = {k: v for k, v in p.items() if v is not None}
+ return filtered_values
+
+ @staticmethod
def replace_sync(name):
"""
:param name: string with item name
diff --git a/generator/transformers/functions_producer.py b/generator/transformers/functions_producer.py
index df8ab2936..8b5a83aee 100644
--- a/generator/transformers/functions_producer.py
+++ b/generator/transformers/functions_producer.py
@@ -119,6 +119,7 @@ class FunctionsProducer(InterfaceProducerCommon):
p['since'] = param.since
p['deprecated'] = param.deprecated
p['origin'] = param.origin
+ p['values'] = self.extract_values(param)
d = self.extract_description(param.description)
if param.name == 'success':
d = 'whether the request is successfully processed'
diff --git a/generator/transformers/structs_producer.py b/generator/transformers/structs_producer.py
index a1af54fe8..c7c5a3058 100644
--- a/generator/transformers/structs_producer.py
+++ b/generator/transformers/structs_producer.py
@@ -105,7 +105,7 @@ class StructsProducer(InterfaceProducerCommon):
p['since'] = param.since
p['deprecated'] = param.deprecated
p['origin'] = param.origin
-
+ p['values'] = self.extract_values(param)
d = self.extract_description(param.description)
if d:
p['description'] = textwrap.wrap(d, 90)