Skip to content

Commit

Permalink
Updated isSet for enum
Browse files Browse the repository at this point in the history
  • Loading branch information
hovo1990 committed Jul 25, 2016
1 parent e55c0db commit 5cf5348
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
1 change: 1 addition & 0 deletions generator/java_code_files/JavaCodeFile.py
Expand Up @@ -292,6 +292,7 @@ def write_attribute_functions(self):
# self.write_function_implementation(code)
self.write_function_java(code)

# TODO enum as string?
# code = attrib_functions.write_get_string_for_enum(True, i)
# self.write_function_implementation(code)

Expand Down
24 changes: 13 additions & 11 deletions generator/java_code_files/java_functions/SetGetFunctions.py
Expand Up @@ -727,7 +727,7 @@ def write_is_set(self, is_attribute, index):
# 'this {1}\'s \"{2}\" {3} is set.' \
# .format(self.true, self.object_name, attribute['name'],
# ob_type)
title_line = '@return '
# title_line = '@return '
if not self.is_java_api:
params.append('@param {0} the {1} structure.'
.format(self.abbrev_parent, self.object_name))
Expand All @@ -737,10 +737,10 @@ def write_is_set(self, is_attribute, index):
.format(self.true, self.object_name,
attribute['name'],
ob_type, self.false))




title_line = ''
params.append('Returns whether {{@link {0}}} is set.'.format(attribute['name']))
params.append(' ')
params.append('@return whether {{@link {0}}} is set.'.format(attribute['name']))
# create the function declaration
if self.is_java_api:
if 'isVector' in attribute and attribute['isVector']:
Expand Down Expand Up @@ -771,16 +771,18 @@ def write_is_set(self, is_attribute, index):
# create the function implementation
if self.is_java_api:
if query.is_string(attribute):
implementation = ['return {0} != null'.format(
implementation = ['return this.{0} != null'.format(
attribute['name'])] # USED
elif attribute['attType'] == 'enum' or attribute['isArray']:
implementation = ['return ({0} != '
'{1})'.format(attribute['name'],
attribute['default'])]
# implementation = ['return ({0} != '
# '{1})'.format(attribute['name'],
# attribute['default'])]
implementation = ['return this.{0} != null'.format(
attribute['name'])] # Used
elif query.has_is_set_member(attribute):
# implementation = ['return '
# 'mIsSet{0}'.format(attribute['capAttName'])]
implementation = ['return {0} != null'.format(
implementation = ['return this.{0} != null'.format(
attribute['name'])] # Used
elif attribute['type'] == 'element':
implementation = ['return ({0} != '
Expand All @@ -791,7 +793,7 @@ def write_is_set(self, is_attribute, index):
'> 0'.format(attribute['name'])]

else:
implementation = ['return {0} != null'.format(
implementation = ['return this.{0} != null'.format(
attribute['name'])] # USED
else:
if not self.is_list_of:
Expand Down

0 comments on commit 5cf5348

Please sign in to comment.