An object automatic conversion method and a 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, and achieving the effect of simplifying steps and improving efficiency

Active Publication Date: 2019-05-03
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 a terminal
  • An object automatic conversion method and a terminal
  • An object automatic conversion method and a 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 invention provides an object automatic conversion method and a terminal, and the method comprises the steps: obtaining a first class, containing a conversion identifier, in a data transmission object DTO according to a preset conversion identifier corresponding to the class; judging whether the first class comprises a preset conversion processing identifier or not, if yes, changing the null field in the first class into an empty character string, and creating a corresponding second class in the view object VO through an APT technology according to the changed first class; if not, creatinga corresponding second class in the view object VO through an APT technology according to the first class; obtaining a first increment field of an annotation containing the increment field in the DTOaccording to the annotation of the preset increment field; according to the first incremental field, the corresponding second incremental field in the view object VO is created through the APT technology, so that the DTO is converted into the corresponding VO, the corresponding class and the corresponding incremental field can be automatically converted, and the object conversion processing efficiency is improved.

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 Applications(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 Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products