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
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
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 ...
PUM
Abstract
Description
Claims
Application Information
- R&D Engineer
- R&D Manager
- IP Professional
- Industry Leading Data Capabilities
- Powerful AI technology
- Patent DNA Extraction
Browse by: Latest US Patents, China's latest patents, Technical Efficacy Thesaurus, Application Domain, Technology Topic, Popular Technical Reports.
© 2024 PatSnap. All rights reserved.Legal|Privacy policy|Modern Slavery Act Transparency Statement|Sitemap|About US| Contact US: help@patsnap.com