Upstream version 9.37.195.0
[platform/framework/web/crosswalk.git] / src / xwalk / tools / reflection_generator / java_class_component.py
1 #!/usr/bin/env python
2
3 # Copyright (c) 2014 Intel Corporation. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file.
6
7 class Field:
8   """Python class represents static field of a java class"""
9   def __init__(self, field_type, name, value, doc):
10     self._field_type = field_type
11     self._field_name = name
12     self._field_value = value
13     self._field_doc = doc
14
15   @property
16   def field_type(self):
17     return self._field_type
18
19   @property
20   def field_name(self):
21     return self._field_name
22
23   @property
24   def field_value(self):
25     return self._field_value
26
27   @property
28   def field_doc(self):
29     return self._field_doc
30
31
32 class Enum:
33   """Python class represents enum type in a java class"""
34   def __init__(self, name, declaration, doc):
35     self._enum_name = name
36     self._enum_declaration = declaration
37     self._enum_doc = doc
38
39   @property
40   def enum_name(self):
41     return self._enum_name
42
43   @property
44   def enum_declaration(self):
45     return self._enum_declaration
46
47   @property
48   def enum_doc(self):
49     return self._enum_doc
50
51   def EnumClassName(self):
52     # return the variable name of the class<?> object for this enum
53     # type in parent class.
54     return 'enum%sClass' % self._enum_name.replace('Internal', '')
55
56   def EnumMethodValueOfName(self):
57     # return the variable name of the Method object for this enum
58     # type's valueOf method in parent class.
59     return '%sValueOfMethod' % self.EnumClassName()
60