You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
1.4 KiB
31 lines
1.4 KiB
|
2 days ago
|
# -*- coding: utf-8 -*-
|
||
|
|
"""Dump method signatures for URL-reworked customer endpoints."""
|
||
|
|
import os, re
|
||
|
|
|
||
|
|
BASE = r'e:\code\crm-backend-matt\crm-customer\src\main\java\com\crm\customer\controller'
|
||
|
|
files = ['CustomerController.java', 'CustomerDetailController.java', 'CustomerFocusController.java',
|
||
|
|
'CustomerImportController.java', 'CustomerTransferController.java', 'CustomerWorkspaceController.java']
|
||
|
|
out = []
|
||
|
|
for fn in files:
|
||
|
|
src = open(os.path.join(BASE, fn), encoding='utf-8').read()
|
||
|
|
src = re.sub(r'/\*.*?\*/', '', src, flags=re.S)
|
||
|
|
src = re.sub(r'//[^\n]*', '', src)
|
||
|
|
out.append('==== ' + fn)
|
||
|
|
for m in re.finditer(r'@(Get|Post|Put|Delete)Mapping\s*(\([^)]*\))?\s*\n\s*public\s+([^\n{]+)\(', src, re.M):
|
||
|
|
out.append(m.group(1).upper() + ' ' + (m.group(2) or '(no path)') + ' -> ' + m.group(3).strip() + '(')
|
||
|
|
# capture full signature until ') {'
|
||
|
|
start = m.end() - 1
|
||
|
|
depth = 0
|
||
|
|
i = m.end() - 1
|
||
|
|
while i < len(src):
|
||
|
|
if src[i] == '(':
|
||
|
|
depth += 1
|
||
|
|
elif src[i] == ')':
|
||
|
|
depth -= 1
|
||
|
|
if depth == 0:
|
||
|
|
break
|
||
|
|
i += 1
|
||
|
|
out.append(' ' + src[start:i+1].replace('\n', ' ').replace(' ', ' '))
|
||
|
|
open(r'e:\code\crm-backend-matt\.scratch\customer-rework\sigs.txt', 'w', encoding='utf-8').write('\n'.join(out))
|
||
|
|
print('OK')
|