summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBilal Alsharifi <bilal.alsharifi@gmail.com>2020-08-20 14:30:41 -0400
committerBilal Alsharifi <bilal.alsharifi@gmail.com>2020-08-20 14:30:41 -0400
commitfd833f2e894bd936bce93eec1aefd22fb9a7cdf9 (patch)
tree4a1bd06974c3e963fd6c6ff2977513e29021f80d
parent61ecc36e07c31a9041791862c7d1e7c466e9a02e (diff)
downloadsdl_android-fd833f2e894bd936bce93eec1aefd22fb9a7cdf9.tar.gz
Add javadoc_added_deprecated.java to reuse same logic for in multiple files
-rw-r--r--generator/templates/base_template.java11
-rw-r--r--generator/templates/enum_template.java13
-rw-r--r--generator/templates/function_template.java17
-rw-r--r--generator/templates/javadoc_added_deprecated.java18
-rw-r--r--generator/templates/javadoc_return.java10
-rw-r--r--generator/templates/javadoc_template.java10
-rw-r--r--generator/templates/struct_template.java17
7 files changed, 29 insertions, 67 deletions
diff --git a/generator/templates/base_template.java b/generator/templates/base_template.java
index d2bdd1a57..5e7391721 100644
--- a/generator/templates/base_template.java
+++ b/generator/templates/base_template.java
@@ -71,16 +71,7 @@ import {{i}};{{ '\n' if loop.last }}
{%- if description is defined and (see is defined or since is defined) %}
*
{%- endif %}
- {%- if deprecated is defined and deprecated is not none and since is defined and since is not none %}
- * @deprecated in SmartDeviceLink {{since}}
- {%- elif deprecated is defined and deprecated is not none %}
- * @deprecated
- {%- elif since is defined and since is not none %}
- * @since SmartDeviceLink {{since}}
- {%- endif %}
- {%- if see is defined %}
- * @see {{see}}
- {%- endif %}
+ {%- include "javadoc_added_deprecated.java" %}
*/
{%- endif %}
{%- if deprecated is not none %}
diff --git a/generator/templates/enum_template.java b/generator/templates/enum_template.java
index aa4f09067..b98bd6c2e 100644
--- a/generator/templates/enum_template.java
+++ b/generator/templates/enum_template.java
@@ -10,17 +10,8 @@ public enum {{class_name}} {
{%- endfor %}{% endif -%}
{%- if param.description is defined and (param.since is defined or param.see is defined) %}
*
- {%- endif %}
- {%- if param.deprecated is defined and param.deprecated is not none and param.since is defined and param.since is not none %}
- * @deprecated in SmartDeviceLink {{param.since}}
- {%- elif param.deprecated is defined and param.deprecated is not none %}
- * @deprecated
- {%- elif param.since is defined and param.since is not none %}
- * @since SmartDeviceLink {{param.since}}
- {%- endif %}
- {%- if param.see is defined %}
- * @see {{param.see}}
- {%- endif %}
+ {%- endif %}{% set see, deprecated, since, spacing = param.see, param.deprecated, param.since, ' ' %}
+ {%- include "javadoc_added_deprecated.java" %}
*/
{%- endif %}
{%- if param.deprecated is defined %}
diff --git a/generator/templates/function_template.java b/generator/templates/function_template.java
index db664b4d2..94392d291 100644
--- a/generator/templates/function_template.java
+++ b/generator/templates/function_template.java
@@ -3,21 +3,8 @@
{%- block params %}
{%- if params is defined %}
{%- for p in params %}
- {%- if p.origin not in ('success', 'resultCode', 'info') or kind != "response" %}
- {%- if p.see is defined or p.deprecated is not none %}
- /**
- {%- if p.deprecated is defined and p.deprecated is not none and p.since is defined and p.since is not none %}
- * @deprecated in SmartDeviceLink {{p.since}}
- {%- elif p.deprecated is defined and p.deprecated is not none %}
- * @deprecated
- {%- elif p.since is defined and p.since is not none %}
- * @since SmartDeviceLink {{p.since}}
- {%- endif %}
- {%- if p.see is defined %}
- * @see {{p.see}}
- {%- endif %}
- */
- {%- endif %}
+ {%- if p.origin not in ('success', 'resultCode', 'info') or kind != "response" %}{% set see, deprecated, since, spacing, begin, end = p.see, p.deprecated, p.since, ' ', '/**', '*/' %}
+ {%- include "javadoc_added_deprecated.java" %}
{%- if p.deprecated is not none %}
@Deprecated
{%- endif %}
diff --git a/generator/templates/javadoc_added_deprecated.java b/generator/templates/javadoc_added_deprecated.java
new file mode 100644
index 000000000..820162c0d
--- /dev/null
+++ b/generator/templates/javadoc_added_deprecated.java
@@ -0,0 +1,18 @@
+{%- if (see is defined and see is not none) or (deprecated is defined and deprecated is not none) or (since is defined and since is not none) %}
+{%- if begin is defined %}
+{{spacing}}{{begin}}
+{%- endif %}
+{%- if deprecated is defined and deprecated is not none and since is defined and since is not none %}
+{{spacing}} * @deprecated in SmartDeviceLink {{since}}
+{%- elif deprecated is defined and deprecated is not none %}
+{{spacing}} * @deprecated
+{%- elif since is defined and since is not none %}
+{{spacing}} * @since SmartDeviceLink {{since}}
+{%- endif %}
+{%- if see is defined %}
+{{spacing}} * @see {{see}}
+{%- endif %}
+{%- if end is defined %}
+{{spacing}} {{end}}
+{%- endif %}
+{%- endif %} \ No newline at end of file
diff --git a/generator/templates/javadoc_return.java b/generator/templates/javadoc_return.java
index 7cde495a0..e4486c3ba 100644
--- a/generator/templates/javadoc_return.java
+++ b/generator/templates/javadoc_return.java
@@ -10,11 +10,5 @@
{%- endif %}
{%- if p.values is defined and p.values %}
* {%- for k in p.values %}{{ ' {' if loop.first}}"{{k}}": {{p.values[k]}}{{ ', ' if not loop.last else '}'}}{%- endfor %}
- {%- endif %}
- {%- if p.deprecated is defined and p.deprecated is not none and p.since is defined and p.since is not none %}
- * @deprecated in SmartDeviceLink {{p.since}}
- {%- elif p.deprecated is defined and p.deprecated is not none %}
- * @deprecated
- {%- elif p.since is defined and p.since is not none %}
- * @since SmartDeviceLink {{p.since}}
- {%- endif %} \ No newline at end of file
+ {%- endif %}{% set see, deprecated, since, spacing = p.see, p.deprecated, p.since, ' ' %}
+ {%- include "javadoc_added_deprecated.java" %} \ No newline at end of file
diff --git a/generator/templates/javadoc_template.java b/generator/templates/javadoc_template.java
index 72cabc94e..3674bf845 100644
--- a/generator/templates/javadoc_template.java
+++ b/generator/templates/javadoc_template.java
@@ -10,11 +10,5 @@
{%- endif %}
{%- if p.values is defined and p.values %}
* {%- for k in p.values %}{{ ' {' if loop.first}}"{{k}}": {{p.values[k]}}{{ ', ' if not loop.last else '}'}}{%- endfor %}
- {%- endif %}
- {%- if p.deprecated is defined and p.deprecated is not none and p.since is defined and p.since is not none %}
- * @deprecated in SmartDeviceLink {{p.since}}
- {%- elif p.deprecated is defined and p.deprecated is not none %}
- * @deprecated
- {%- elif p.since is defined and p.since is not none %}
- * @since SmartDeviceLink {{p.since}}
- {%- endif %} \ No newline at end of file
+ {%- endif %}{% set see, deprecated, since, spacing = p.see, p.deprecated, p.since, ' ' %}
+ {%- include "javadoc_added_deprecated.java" %} \ No newline at end of file
diff --git a/generator/templates/struct_template.java b/generator/templates/struct_template.java
index 285df3292..704153648 100644
--- a/generator/templates/struct_template.java
+++ b/generator/templates/struct_template.java
@@ -2,21 +2,8 @@
{%- block params %}
{%- if params is defined %}
- {%- for p in params %}
- {%- if p.see is defined or p.deprecated is not none %}
- /**
- {%- if p.deprecated is defined and p.deprecated is not none and p.since is defined and p.since is not none %}
- * @deprecated in SmartDeviceLink {{p.since}}
- {%- elif p.deprecated is defined and p.deprecated is not none %}
- * @deprecated
- {%- elif p.since is defined and p.since is not none %}
- * @since SmartDeviceLink {{p.since}}
- {%- endif %}
- {%- if p.see is defined %}
- * @see {{p.see}}
- {%- endif %}
- */
- {%- endif %}
+ {%- for p in params %}{% set see, deprecated, since, spacing, begin, end = p.see, p.deprecated, p.since, ' ', '/**', '*/' %}
+ {%- include "javadoc_added_deprecated.java" %}
{%- if p.deprecated is not none %}
@Deprecated
{%- endif %}