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

Control method, device and equipment for printing attribute value of model class, and medium

A printing control and class attribute technology, applied in the field of communication, can solve problems such as large memory usage, heavy system load, and complicated writing, and achieve the effect of small code writing, small system load, and memory saving

Pending Publication Date: 2020-04-10
TAIKANG LIFE INSURANCE CO LTD
View PDF5 Cites 0 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0015] The embodiment of the present invention provides a method, device, medium and equipment for controlling the printing of model attribute values, which are used to solve the problems of the existing method of printing attribute values ​​of model types, which occupy a large amount of memory, complicate writing, or have a large system load

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
  • Control method, device and equipment for printing attribute value of model class, and medium
  • Control method, device and equipment for printing attribute value of model class, and medium
  • Control method, device and equipment for printing attribute value of model class, and medium

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0047] Embodiment 1 of the present invention provides a method for controlling the printing of model class attribute values. The steps of the method can be as follows Figure 6 shown, including:

[0048] Step 101, acquire attributes.

[0049] It should be noted that the premise of the implementation of the method provided in this embodiment is that a parent class is defined for all model classes in the target program, and the attributes of the parent class are empty or the common attributes of all model classes are added to the parent class.

[0050] Then, in this step, attributes of a class object of a model class can be obtained through a reflection mechanism.

[0051] Step 102, acquiring attribute value data.

[0052] In this step, the attribute value of each attribute obtained in step 101 can be further obtained, and each attribute and its attribute value can be assembled into Stringbuffer type data.

[0053] In a possible implementation, this step may include: for each...

Embodiment 2

[0077] Embodiment 2 of the present invention provides a method for controlling the printing of model class attribute values, defining a parent class (assuming it is named parent class) for all model classes in the target program, and the attribute of the parent class is empty or shared by all model classes After the attribute is added to the parent class, the steps of the method can be as follows Figure 7 shown, including:

[0078] Step 201, obtain the class object through the getclass method.

[0079] In this step, the incoming class can be received as an Object type, and the class object of the class can be obtained through the getclass method. Initially, the incoming class is the model class of the attribute value to be printed.

[0080] Step 202, obtain all attributes through reflection mechanism.

[0081] In this step, all attributes of the class object obtained in the first step can be obtained through the reflection mechanism.

[0082] Step 203, loop through all at...

Embodiment 3

[0097] Embodiment 3 of the present invention provides a model class attribute value printing control device, which pre-defines a parent class for all model classes in the target program, and the attribute of the parent class is empty or the common attributes of all model classes are added to the parent class, The structure of the device can be as Figure 8 shown, including:

[0098] Attribute obtaining module 11 is used for obtaining the attribute of the class object of a model class by reflection mechanism;

[0099] Attribute value data acquisition module 12 is used for obtaining the attribute value of each attribute that described attribute acquisition module acquires, and each attribute and attribute value thereof are assembled into the data of Stringbuffer type;

[0100] The parent class attribute value data module 13 is used for judging whether there is a parent class in the model class by using a reflection mechanism, if there is a parent class, and the parent class is ...

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 relates to a control method and device and equipment for printing the attribute value of a model class, and a medium. The control method comprises the following steps: defining a parentclass to all model classes in a target program, defining the attribute of the parent class as null or a common attribute of all model classes, acquiring the attribute value of each attribute in a model class through a JAVA reflection mechanism and a recursive algorithm, and after Stringbuffer type data assembly is performed on each attribute and the attribute value of each attribute, allowing allassembled data to return in a character string type so as to realize printing of the attribute value of the model class. According to a scheme provided by the invention, each attribute and the attribute value thereof are assembled into the Stingbuffer type data, and space does not need to be frequently opened up to store temporary data, so the memory can be effectively saved; the attribute value of each attribute is obtained through a reflection mechanism and the recursive algorithm, so the code writing amount is small; meanwhile, a third-party jar package does not need to be introduced, so the system load is small.

Description

technical field [0001] The invention relates to the field of communication technology, in particular to a method, device, medium and equipment for controlling printing of model attribute values. Background technique [0002] In the development process of JAVA, the object model class is indispensable. The model class can be used for data storage, value transfer, comparison, etc. The basic structure of the model class can be as follows figure 1 shown. [0003] In the process of interacting with the database, the model class is even more essential. A database table often corresponds to one or more model classes. A small and medium-sized project often has at least dozens or even hundreds of model classes. The attributes range from dozens to as many as fifty or sixty. After querying the database or receiving data, it may be necessary to print out the attribute value of a model class in the form of a log, but JAVA prints not the attribute value by default, but the full class nam...

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
IPC IPC(8): G06F8/71
CPCG06F8/71
Inventor 谢向钊
Owner TAIKANG LIFE INSURANCE CO 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