Today I will share with you a "Java Po conversion to C # Po tool ",CodeBelow, I hope to help my friends in need
/Files/flex/converttool_v1.0bydsk.rar
Background: The company's architecture and background services are written in Java, and the foreground is written in C #. As the background Java has a large number of Po objects (Database ing Po, business-required Po ), the background Java data is transmitted to the foreground through the JSON format (fastjson) (C #)
C # to convert the JSON format to the same PO, because there is no ready-made tool, you have written a Java Po to C # Po tool.
Code structure:
Implementation ideas:
1. Load the configuration file
2. Use jarhelper to filter out classname strings that meet the criteria (Regular Expression filtering)
3. Use the classname string and urlclassloader class (classloaderhelper) to obtain the corresponding type of the string clazz
4. Call reflextionhelper through type clazz to reflect the set and get methods of the class (code obfuscation supported)
5. Obtain the Java Po field (javapropertyinfo). In the Po attribute converted to C # (csharppropertyinfo)
6. Generate the Po of C # according to the template file of C #.
7. Call filehelper to write the file.
The code is completed today and shared. I hope to provide a reference for anyone who needs it. If you have any questions, please discuss it.