Java Po conversion to C # Po Tool

Source: Internet
Author: User

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.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.