|
1 | 1 | #!/usr/bin/env python |
2 | 2 | # -*- coding: utf-8 -*- |
3 | 3 |
|
| 4 | +## number of spaces to indent each block |
4 | 5 | indent = 4 |
5 | 6 |
|
| 7 | +## prefix for comments |
| 8 | +commentPrefix = '##' |
| 9 | + |
| 10 | +## move inner class definitions to the top of their outer class. |
| 11 | +## allows the outer class to reference the inner class definition |
| 12 | +## later in its definition. |
| 13 | +bubbleInnerClasses = True |
| 14 | + |
| 15 | +## if True, classes are scanned for methods that look like accessors. |
| 16 | +## Matching methods are renamed and declared as properties. |
| 17 | +fixPropMethods = True |
| 18 | + |
| 19 | +## if True, classes are scanned for duplicate method names. Matching |
| 20 | +## methods are augmented with the '@overloaded' decorator. |
| 21 | +fixOverloadMethods = True |
| 22 | + |
| 23 | +## if True, class methods are sorted by name before output. |
| 24 | +sortClassMethods = False |
| 25 | + |
| 26 | +## if True, method modifiers are written as comments prior to method |
| 27 | +## declarations. |
| 28 | +writeModifiersComments = False |
| 29 | + |
| 30 | +## if True, a default docstring is generated for class statements. |
| 31 | +writeClassDocString = True |
| 32 | + |
| 33 | +## if True, a default docstring is generated for method statements. |
| 34 | +writeMethodDocString = False |
| 35 | + |
| 36 | +## if True, classes without base classes will instead inherit from |
| 37 | +## object. |
| 38 | +classesInheritObject = True |
| 39 | + |
| 40 | +## minimum parameter count to trigger indentation of parameter names |
| 41 | +## in method declarations. set to 0 to disable. |
| 42 | +minIndentParams = 5 |
| 43 | + |
| 44 | +## lines written at the beginning of each generated module. this value |
| 45 | +## is cumulative, so when user-defined configuration modules specify |
| 46 | +## this value, those lines are written after these. |
| 47 | +modulePreamble = [ |
| 48 | + '#!/usr/bin/env python', |
| 49 | + '# -*- coding: utf-8 -*-', |
| 50 | + '', |
| 51 | + ] |
6 | 52 |
|
| 53 | +## regular expression substitutions performed on source after |
| 54 | +## generation but before final output. this value is cumulative, so |
| 55 | +## user-defined configuration modules can add augment these with their |
| 56 | +## own. each value in this list is a two-tuple of (pattern, repl). |
| 57 | +## see the 're' module docs, specifically the re.sub function. |
7 | 58 | outputSubs = [ |
8 | 59 | (r'(\.self\.)', '.'), |
9 | 60 | (r'String\.valueOf\((.*?)\)', r'str(\1)'), |
|
14 | 65 | (r'(\w+)\.get\((.*?)\)', r'\1[\2]'), |
15 | 66 | ] |
16 | 67 |
|
17 | | - |
| 68 | +## mapping of java type names to python type names. user-defined |
| 69 | +## configuration modules can replace and/or augment this mapping. |
18 | 70 | typeTypeMap = { |
19 | 71 | 'String':'str', |
20 | 72 | 'int':'int', |
|
23 | 75 | 'boolean':'bool', |
24 | 76 | } |
25 | 77 |
|
26 | | - |
| 78 | +## mapping of java type values to python type values. user-defined |
| 79 | +## configuration modules can replace and/or augment this mapping. |
27 | 80 | typeValueMap = { |
28 | 81 | 'String':'""', |
29 | 82 | 'int':'0', |
|
33 | 86 | 'str':'""', |
34 | 87 | } |
35 | 88 |
|
36 | | - |
| 89 | +## method name mapping. user-defined configuration modules can |
| 90 | +## replace and/or augment this with their own. |
37 | 91 | renameMethodMap = { |
38 | 92 | 'equals':'__eq__' |
39 | 93 | } |
40 | 94 |
|
41 | | - |
| 95 | +## generic name mapping. user-defined configuration modules can |
| 96 | +## replace and/or augment this with their own. |
42 | 97 | renameAnyMap = { |
43 | 98 | 'this':'self', |
44 | 99 | 'null':'None', |
45 | 100 | 'false':'False', |
46 | 101 | 'true':'True', |
47 | 102 | } |
48 | 103 |
|
49 | | - |
| 104 | +## method type modifier mapping. when input methods have modifiers |
| 105 | +## with matching names, those names are replaced with their |
| 106 | +## corresponding statements from this mapping. this value can be |
| 107 | +## replaced and/or augmented via user-defined configuration modules. |
50 | 108 | modifierDecoratorMap = { |
51 | 109 | 'synchronized':'## original method synchronized' |
52 | 110 | } |
53 | | - |
54 | | - |
55 | | -modulePreable = [ |
56 | | - '#!/usr/bin/env python', |
57 | | - '# -*- coding: utf-8 -*-', |
58 | | - '', |
59 | | - ] |
60 | | - |
61 | | - |
62 | | -bubbleInnerClasses = True |
63 | | -scanPropMethods = True |
64 | | -scanOverloadMethods = True |
65 | | -sortClassMethods = False |
66 | | -writeModifiersComments = False |
67 | | -writeClassDocString = True |
68 | | - |
69 | | -commentPrefix = '##' |
|
0 commit comments