Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

An object automatic conversion method and terminal

An automatic conversion and object technology, applied in the field of data processing, can solve the problems of increasing the amount of code, increasing the workload, and the data structure of the server is not good, so as to simplify the steps and improve the efficiency

Active Publication Date: 2022-02-11
FUJIAN TIANQUAN EDUCATION TECH LTD
View PDF3 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0003] 1. In the returned data, it is possible that a certain field returns null, and multiple null-judgment operations are required during use, which increases the amount of code to a certain extent;
[0004] 2. The data structure returned by the server or the name of one or more fields changes, causing the client to crash;
[0005] 3. The data structure returned by the server is not what is required
[0006] The existing DTO (data transfer object, data transfer object) solution is to manually add a layer of conversion layer before displaying the data, and convert the data of the server into the data of the target object first. Structure, no matter what the data type returned by the interface is, the client will only get the converted fields to display the data, but this increases the number of code layers, and each interface needs to be converted. When there are many returned fields, Conversion requires more operations, greatly increasing the workload

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • An object automatic conversion method and terminal
  • An object automatic conversion method and terminal

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0071] Please refer to figure 1 , Embodiment 1 of the present invention is:

[0072] The invention provides a method for automatic object conversion, comprising the following steps:

[0073] S0: After introducing the APT technology into the project corresponding to the DTO, create the first java library, the first java library includes the conversion identifier, field renaming annotation and incremental field annotation;

[0074] Create a second java library, the second java library includes an open source java code generation framework and multiple third-party libraries;

[0075] Wherein, the field renaming annotation includes the first field renaming annotation and the second field renaming annotation; the conversion identifier corresponds to the class, that is, the conversion identifier is located in the class; and the conversion processing identifier is also located in the class, of course not All classes contain the above logos and need to be judged;

[0076] S1: Obtai...

Embodiment 2

[0088] Please refer to figure 2 , the second embodiment of the present invention is:

[0089] The present invention provides an object automatic conversion terminal, comprising a memory 1, a processor 2 and a computer program stored in the memory 1 and operable on the processor 2, and the processor implements the following steps when executing the computer program:

[0090] S0: After introducing the APT technology into the project corresponding to the DTO, create the first java library, the first java library includes the conversion identifier, field renaming annotation and incremental field annotation;

[0091] Create a second java library, the second java library includes an open source java code generation framework and multiple third-party libraries;

[0092] Wherein, the field renaming annotation includes the first field renaming annotation and the second field renaming annotation; the conversion identifier corresponds to the class, that is, the conversion identifier is...

Embodiment 3

[0106] The purpose of the present invention is to solve the problem of a large amount of workload caused by manually implementing the conversion layer, and improve work efficiency. The present invention is based on APT (Annotation Processing Tool annotation processor) technology to dynamically generate code (zero reflection) during compilation, and generate objects and conversion processing classes displayed on the VO interface during Android compilation (judging whether it is empty, and the field name Modify operation), used to convert the data required on the interface, and finally solve the problem of manual conversion.

[0107] In order to solve the problems of the above technologies, the present invention adopts the following solutions:

[0108] 1. Introduce APT technology into the project and create a custom-annotated java library (the first java library), which is used to place the annotation classes needed in the project, that is, custom annotation classes, such as: Co...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

PUM

No PUM Login to View More

Abstract

The present invention provides an object automatic conversion method and a terminal. According to the preset conversion identifier corresponding to the class, the first category containing the conversion identifier in the data transmission object DTO is obtained; and it is judged whether the first category includes the preset conversion Process the identification, if yes, change the null field in the first category to an empty string, and create the corresponding second category in the view object VO through APT technology based on the changed first category; if not, then based on The first category, through the APT technology, creates the corresponding second category in the view object VO; according to the annotation of the preset incremental field, obtains the first incremental field in the DTO containing the annotation of the incremental field; according to The first incremental field, through APT technology, creates the corresponding second incremental field in the view object VO, so as to realize the conversion of DTO into the corresponding VO, and can automatically convert the corresponding class and incremental field, which improves the object conversion processing efficiency.

Description

technical field [0001] The invention relates to the technical field of data processing, in particular to an object automatic conversion method and a terminal. Background technique [0002] In the previous Android data display layer, we directly used the data returned by the server to convert it into an entity, and displayed the data by obtaining fields, but if it is used directly, there will be the following disadvantages: [0003] 1. In the returned data, a certain field may return null, and multiple null-judgment operations are required during use, which increases the amount of code to a certain extent; [0004] 2. The data structure returned by the server or the name of one or more fields changes, causing the client to crash; [0005] 3. The data structure returned by the server is not what is needed. [0006] The existing DTO (data transfer object, data transfer object) solution is to manually add a layer of conversion layer before displaying the data, and convert the ...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to View More

Application Information

Patent Timeline
no application Login to View More
Patent Type & Authority Patents(China)
IPC IPC(8): G06F8/20G06F8/30
Inventor 刘德建郭玉湖曾慧萍
Owner FUJIAN TIANQUAN EDUCATION TECH LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products