Data processing method and device, electronic equipment, program product and storage medium
The Java reflection mechanism is used to dynamically create or call class instances in IoT sensor data processing, which solves the problem of frequent modification of business logic in the existing technology, achieves flexibility and efficiency, and reduces maintenance costs.
Patent Information
- Application Number
- CN202410462736.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-17
- Publication Date
- 2024-10-18
AI Technical Summary
In existing IoT sensor data processing solutions, business logic is usually pre-coded in the application platform, resulting in the need to modify the source code when the logic needs to be changed or expanded, increasing development and maintenance complexity, and may cause system downtime and affect user experience. .
The Java reflection mechanism is used to obtain the class information in the data to be processed to determine whether there is a corresponding class instance. If it exists, the instance function is called to process the data. If it does not exist, a new instance is created and its function is called to dynamically determine the data processing logic.
It can flexibly adapt to business needs without modifying the application platform code, reduce maintenance costs, improve data processing efficiency, and enhance the flexibility and scalability of the system.
Smart Images

Figure CN118796166A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a data processing method, device, electronic device, computer program product, and computer-readable storage medium. Background Art
[0002] In the existing technical solutions, after collecting data, IoT sensors will report the data to the application platform through the open platform or other device access gateway. After receiving the data, the application platform will process it accordingly according to the preset business logic, thereby realizing the monitoring and control of remote devices.
[0003] However, a major disadvantage of this solution is that the business processing logic is usually pre-coded in the application platform, and the business logic that is not pre-coded will not be executed. If the business logic needs to be changed or extended, the source code of the application platform must be modified and then redeployed. This not only increases the complexity of development and maintenance, but may also cause system downtime and affect user experience. Summary of the invention
[0004] The present disclosure is proposed in view of the above problems. The present disclosure provides a data processing method, device, electronic device, computer program product and computer readable storage medium.
[0005] According to one aspect of the present disclosure, a data processing method is provided, including: receiving data to be processed, wherein the data to be processed includes at least class information and function information; determining first-category information corresponding to the data to be processed based on a reflection mechanism; determining whether there is a class instance corresponding to the first-category information based on the first-category information; when there is no class instance, creating a class instance corresponding to the first-category information, and calling a function corresponding to the class instance to process the data to be processed; when there is a class instance, calling a function corresponding to the class instance to process the data to be processed.
[0006] In addition, according to an aspect of the data processing method of the present disclosure, determining the first type of information corresponding to the data processing based on the reflection mechanism includes: parsing the type of information based on the reflection mechanism to determine the first type of information related to the data to be processed.
[0007] In addition, according to a data processing method in one aspect of the present disclosure, when there is no class instance, a class instance corresponding to the first type of information is created, and the second function information corresponding to the class instance is called to perform data processing, including: based on the first type of information, obtaining a class object; based on the class object, creating a class instance corresponding to the class object; based on the class object, calling the function corresponding to the class instance to process the data to be processed.
[0008] In addition, according to a data processing method in one aspect of the present disclosure, when there is a class instance, the function information corresponding to the class instance is called to perform data processing, including: based on the first type of information, obtaining the class object; based on the class object, calling the function corresponding to the class instance to process the data to be processed.
[0009] According to another aspect of the present disclosure, a data processing method includes: receiving data to be processed from a terminal device; forwarding the data to be processed to an application platform for processing the data to be processed; wherein the data to be processed includes at least class information and function information.
[0010] According to another aspect of the present disclosure, a data processing method includes: collecting sensor data; generating data to be processed based on the sensor data; sending the data to be processed to an open platform for processing the data to be processed; wherein the data to be processed includes at least class information and function information.
[0011] According to another aspect of the present disclosure, a data processing device is provided, including: a data receiving unit, configured to receive data to be processed, wherein the data to be processed includes at least class information and function information; a first-category information determination unit, configured to determine the first-category information corresponding to the data to be processed based on a reflection mechanism; a class instance judgment unit, configured to determine whether there is a class instance corresponding to the first-category information based on the first-category information; a first data processing unit, configured to create a class instance corresponding to the first-category information when there is no class instance, and call the function corresponding to the class instance to process the data to be processed; and a second data processing unit, configured to call the function corresponding to the class instance to process the data to be processed when there is a class instance.
[0012] According to another aspect of the present disclosure, an electronic device is provided, including: a memory for storing computer-readable instructions; and a processor for executing the computer-readable instructions so that the electronic device executes the data processing method as described above.
[0013] According to another aspect of the present disclosure, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the data processing method as described above is implemented.
[0014] According to another aspect of the present disclosure, a computer-readable storage medium is provided for storing computer-readable instructions. When the computer-readable instructions are executed by a processor, the processor executes the data processing method as described above.
[0015] As will be described in detail below, according to the data processing method, device, electronic device, computer program product and computer-readable storage medium of the embodiments of the present disclosure, the present disclosure utilizes the Java reflection mechanism to obtain the class information in the data to be processed, and can determine whether a class instance corresponding to the class information already exists. If it exists, the corresponding function of the class instance is directly called to process the data; if it does not exist, a new class instance is created and its function is called to process the data, so that when processing data, it is possible to dynamically decide how to process different data to be processed without having to write fixed code logic in advance. This enables the system to adapt to changing business needs more easily, reduces maintenance costs, and improves data processing efficiency.
[0016] It is to be understood that both the foregoing general description and the following detailed description are exemplary, and are intended to provide further explanation of the technology as claimed. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The above and other purposes, features and advantages of the present disclosure will become more apparent by describing the embodiments of the present disclosure in more detail in conjunction with the accompanying drawings. The accompanying drawings are used to provide a further understanding of the embodiments of the present disclosure and constitute a part of the specification. Together with the embodiments of the present disclosure, they are used to explain the present disclosure and do not constitute a limitation of the present disclosure. In the accompanying drawings, the same reference numerals generally represent the same components or steps.
[0018] Figure 1 It is a schematic diagram illustrating an application scenario of the data processing method according to an embodiment of the present disclosure.
[0019] Figure 2 is a flowchart illustrating a data processing method according to an embodiment of the present disclosure.
[0020] Figure 3 is a flowchart further illustrating a data processing method according to an embodiment of the present disclosure.
[0021] Figure 4 is another flowchart illustrating a data processing method according to an embodiment of the present disclosure.
[0022] Figure 5 is another flowchart illustrating a data processing method according to an embodiment of the present disclosure.
[0023] Figure 6 is a functional block diagram illustrating a data processing device according to an embodiment of the present disclosure.
[0024] Figure 7 is a hardware block diagram illustrating an electronic device according to an embodiment of the present disclosure.
[0025] Figure 8is a schematic diagram illustrating a computer program product according to an embodiment of the present disclosure.
[0026] Fig. 9 is a schematic diagram illustrating a computer-readable storage medium according to an embodiment of the present disclosure. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical solution and advantages of the present disclosure more obvious, the exemplary embodiments according to the present disclosure will be described in detail with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all the embodiments of the present disclosure, and it should be understood that the present disclosure is not limited to the exemplary embodiments described here.
[0028] First, refer to Figure 1-5 A data processing method according to an embodiment of the present disclosure is described. Figure 1 It is a schematic diagram illustrating an application scenario of the data processing method according to an embodiment of the present disclosure. Figure 2 is a flowchart illustrating a data processing method according to an embodiment of the present disclosure. Figure 3 is a flowchart further illustrating a data processing method according to an embodiment of the present disclosure. Figure 4 is another flowchart illustrating a data processing method according to an embodiment of the present disclosure. Figure 5 is another flowchart illustrating a data processing method according to an embodiment of the present disclosure.
[0029] like Figure 1 As shown, the application scenario 100 of the data processing method according to the embodiment of the present disclosure is mainly used to realize the data interaction and processing between the terminal device 101 and the application platform 103. The application scenario 100 is mainly composed of the terminal device 101, the open platform 102 and the application platform 103. Among them, the terminal device 101 is a front-end device in the Internet of Things system, which integrates various sensors and communication modules, and can collect the status data of the environment or equipment in real time. These data may include environmental parameters such as temperature, humidity, pressure, and light, or the working status of the equipment, power usage, etc. And the terminal device 101 can also send data to the open platform 102 through the network. The open platform 102 provides data management and storage functions, receives data from the terminal device 101, and reports these data to the application platform 103. The application platform 103 is the back-end system in the application scenario of the data processing method, which is responsible for receiving data from the open platform 102, and performing in-depth processing and analysis on these data according to business needs. Among them, the open platform 102 provides a series of functions such as device access, data management, and application development. Through the open platform, it is easy to access devices and upload data. It is easy to understand that Figure 1The devices or platforms related to the implementation of the data processing method are only schematically shown, and the application scenarios of the data processing method for implementing the embodiments of the present disclosure are not limited thereto.
[0030] In the application scenario of the existing data processing method, data is uploaded to the application platform 103 through the terminal device 101, and the application platform 103 parses the uploaded data and performs relevant business operations. The control of data processing is entirely in the hands of the application platform 103. The business processing of each set of data needs to be pre-encoded, and the logic that has not been coded will not be executed. The terminal device 101 cannot call different business processes according to different situations. If a certain situation or data type is not encoded, the application platform 103 will not be able to recognize and process these newly emerging data. This existing data processing method lacks flexibility and scalability. With the continuous changes in business needs and the increase in data types, the application platform 103 needs to continuously update and expand the code logic to adapt to new data processing needs. This not only increases the cost of development and maintenance, but may also lead to low processing efficiency and increased error rates.
[0031] In the embodiment of the present disclosure, in the application platform developed by JAVA, when the terminal device reports the data, it also reports the class (interface) and function information for processing the data. The application platform creates a related class based on the class (interface) and function information, and uses this class to process the data and business logic. In this way, the entire business scheduling and arrangement can be completed through terminal adjustments without any adjustment on the application platform.
[0032] Will refer to Figure 2 The data processing method according to the embodiment of the present disclosure is described in detail.
[0033] like Figure 2 As shown, the data processing method according to the embodiment of the present disclosure includes the following steps.
[0034] In step S201, data to be processed is received, wherein the data to be processed at least includes class information and function information.
[0035] It is understandable that the data to be processed may refer to the state data of the environment or equipment collected by the terminal device. After preprocessing and formatting operations, these data can generate data to be processed that includes at least class information and function information, which is used to extract valuable information or make decisions. The terminal device sends these data to be processed to the open platform, and the open platform reports the data to be processed to the application platform. After the application platform receives the data from the open platform, the application platform processes the data to be processed according to business needs. Class information refers to the detailed information of the Java class associated with the data to be processed, for example, including the class name or interface name. Function information refers to the name of the function to be called when processing the data to be processed. The application platform can load the corresponding class according to the class information and function information, and call the correct function to process the data to meet specific business needs.
[0036] In one embodiment of the present disclosure, the data to be processed may be sensor data collected by the terminal device through a sensor, which is generated after preprocessing and formatting operations, and the data to be processed includes at least sensor data, class information and function information.
[0037] In step S202, the first type of information corresponding to the data to be processed is determined based on the reflection mechanism.
[0038] It is understandable that the application platform uses the class information in the received data to be processed to determine the first type of information corresponding to the data through the reflection mechanism. This first type of information usually refers to a specific Java class or interface and the package where the Java class or interface is located, which determines the class corresponding to the method used to process the data to be processed.
[0039] In one embodiment of the present disclosure, the class information can be parsed based on the reflection mechanism to determine the first type of information related to the data to be processed. Specifically, the application platform first parses the class information in the data to be processed and extracts key information such as the class name and package name of the class. Then, the application platform can obtain the first type of information about the class, including its class name and package name. This information will be used in subsequent data processing steps.
[0040] In one embodiment of the present disclosure, the class information and function information can also be parsed based on the reflection mechanism to determine the first category information and the first function information related to the data to be processed. Specifically, the application platform first parses the class information and the function information in the data to be processed, and extracts key information such as the class name, package name, and function name of the class. Then, the application platform can obtain the first category information and the first function information about the class to be called, including its class name, package name, and function name. This information will be used in subsequent data processing steps.
[0041] The above reflection mechanism may be a Java reflection mechanism.
[0042] By determining the first type of information through the reflection mechanism, the application platform can dynamically adapt to different data processing requirements at runtime without hard-coding specific class information at compile time. This increases the flexibility and scalability of the system, making it easier for the application platform to integrate new data processing logic or adapt to changes in business rules.
[0043] In step S203, based on the first type of information, it is determined whether there is a class instance corresponding to the first type of information.
[0044] If a positive result is obtained in step S203, that is, there is a class instance corresponding to the first type of information, the process proceeds to step S205. On the contrary, if a negative result is obtained in step S203, that is, there is no class instance corresponding to the first type of information, the process proceeds to step S204.
[0045] In one embodiment of the present disclosure, the application platform further determines whether there is a class instance corresponding to the first type of information determined by the reflection mechanism. The class instance is a concretization of the first type of information, which includes all the properties and methods defined by the class and may include specific status information.
[0046] In one embodiment of the present disclosure, it is determined whether a class instance corresponding to the first type of information exists. Specifically, the existing instance may be checked: the application platform first checks whether a class instance corresponding to the first type of information already exists inside it. For example, this is accomplished by checking a cache, a container (JVM container), or other storage mechanisms, which may store previously created class instances.
[0047] When it is determined that there is no class instance, the process proceeds to step S204.
[0048] In step S204, when there is no class instance, a class instance corresponding to the first type of information is created, and a function corresponding to the class instance is called to process the data to be processed.
[0049] In one embodiment of the present disclosure, when the application platform determines that there is no class instance corresponding to the first type of information, it will create a new class instance according to the first type of information and call the corresponding function on the class instance. Thus, it is possible to dynamically create a class instance when there is no existing class instance and call the corresponding method to process the data to be processed. Thus, the application platform can flexibly adapt to different data processing requirements and expand its functions.
[0050] When it is determined that there is a class instance, the process proceeds to step S205.
[0051] In step S205, when there is a class instance, a function corresponding to the class instance is called to process the data to be processed.
[0052] In an example of the present disclosure, when it is determined that there is a class instance corresponding to the first type of information, the function corresponding to the class instance is directly called to process the data to be processed, so that the application platform can process the data to be processed according to the expected logic.
[0053] The above data processing method receives the data to be processed, uses the reflection mechanism to determine the class information and function information, and dynamically creates class instances or calls functions on existing instances to process data based on this information, thereby achieving flexible, efficient, stable and easy-to-maintain data processing effects.
[0054] Figure 3 It further illustrates the data processing method according to the embodiment of the present disclosure.
[0055] like Figure 3 As shown, the data processing method according to the embodiment of the present disclosure includes the following steps. Among them, steps S301-S303 are the same as steps S201-S203, and will not be repeated here.
[0056] In step S303, based on the first category information, it is determined whether there is a class instance corresponding to the first category information. If a positive result is obtained in step S303, that is, there is a class instance corresponding to the first category information, the process proceeds to step S307. On the contrary, if a negative result is obtained in step S303, that is, there is no class instance corresponding to the first category information, the process proceeds to step S304.
[0057] In step S304, a class object is obtained based on the first class information.
[0058] It can be understood that a class object is the representation of an object in a computer, such as defining a class of "person" to create a specific "person" from humans.
[0059] In one embodiment of the present disclosure, the class object corresponding to the first type of information can be obtained. Specifically, the first type of information includes a package name and a class name, and the first type of information is loaded according to the class name to obtain a class object, that is, a Class object.
[0060] Specifically, use the Class.forName method to get the Class object through the package name and class name.
[0061] In step S305, based on the class object, a class instance corresponding to the class object is created.
[0062] It is understandable that class instances refer to specific "objects" created from class objects. Each object has the same methods, but their data may be different. For example, through the Person class, two "person" objects are created, namely Zhang San and Li Si. Zhang San and Li Si are instances. They have different ID numbers, may be male, and may be of different ages, but they both have the ability to speak or walk, etc.
[0063] In one embodiment of the present disclosure, creating a class instance corresponding to a class object based on a class object means using an already acquired class object (Class object) to create a class instance corresponding to the class object. In other words, a class object describes the structure (attributes and methods) of a class, while a class instance is a concrete object of the class.
[0064] In one embodiment of the present disclosure, a class instance corresponding to the class object can be created by using the "getConstructor().newInstance()" method to obtain the constructor and create an instance through the already acquired class object. Specifically, getConstructor() is used to obtain the public constructor of the class. When this method is called, it returns a constructor Constructor object representing the public constructor of the class. newInstance() is used to create a new instance of the class based on the Constructor object. When this method is called, the corresponding constructor is used to create a new object instance. Therefore, getConstructor().newInstance() is combined to first obtain the public constructor of the class, and then use this constructor to create a new instance of the class.
[0065] In one embodiment of the present disclosure, suppose there is a class named Car, which describes the basic properties and behaviors of a car. Now, if you want to create an instance of the Car class, first, you need to obtain the Class object of the Car class, and then use this object to create an instance. In this example, you can first obtain the Class object of the Car class through Car.class. Then, use the getConstructor method to obtain the Constructor object that matches the constructor of the Car class. Finally, use the newInstance method and pass in the corresponding parameters to create a new instance of the Car class.
[0066] In step S306, based on the class object, a function corresponding to the class instance is called to process the data to be processed.
[0067] It can be understood that the function corresponding to the class instance refers to the method that the class instance can call (that is, the member function of the class). The class defines the structure and behavior of the object, and the method is the function defined in the class to implement the behavior of the class.
[0068] In one embodiment of the present disclosure, the function corresponding to the class instance is called based on the class object to process the data to be processed. According to the known class instance, one or more methods of the class to which it belongs are called through this class instance to process the data to be processed, and the corresponding processing logic is executed.
[0069] In one embodiment of the present disclosure, if a Class object is already available, a getMethod method can be used to obtain a Method object representing a specific method. This method requires the name of the method and its parameter types as parameters. The function is called by calling the invoke method of the Method object.
[0070] In one embodiment of the present disclosure, it is assumed that there is a banking-related class that defines the methods and properties required to process banking data. A class instance represents a specific banking scenario or entity, such as a bank account, a transaction, etc. This class defines some member functions (i.e., methods) for processing banking data. For example, it may have a method for calculating interest, another method for transferring money, and another method for generating transaction reports, etc. When there is "banking data" (i.e., data to be processed) that needs to be processed, the method corresponding to this class instance can be called through the class instance according to specific business needs. These methods will receive "banking data" as parameters and execute corresponding processing logic.
[0071] Through the above method, the methods of the class can be called dynamically when processing the data to be processed, without knowing the specific information of these methods at compile time.
[0072] In step S303, when it is determined that there is a class instance corresponding to the first type of information, the process proceeds to step S307.
[0073] In step S307, the class object is obtained based on the class information.
[0074] This step is the same as step S304 and will not be described again here.
[0075] In step S308, based on the class object, a function corresponding to the class instance is called to process the data to be processed.
[0076] This step is the same as step S306 and will not be described again here.
[0077] Figure 4is another diagram illustrating a data processing method according to an embodiment of the present disclosure.
[0078] like Figure 4 As shown, the data processing method according to the embodiment of the present disclosure includes the following steps.
[0079] In step S401, data to be processed is received from a terminal device.
[0080] In the embodiments of the present disclosure, the data to be processed may refer to the state data of the environment or device collected by the terminal device, which is pre-processed and formatted to generate the data to be processed. The data to be processed may be uploaded to the open platform through the terminal device, and then the open platform receives the data to be processed.
[0081] In step S402, the data to be processed is forwarded to the application platform for processing the data to be processed; wherein the data to be processed at least includes class information and function information.
[0082] It is understandable that when the open platform receives the data to be processed uploaded from the terminal device, it can forward the data to be processed to the application platform. The data to be processed includes at least class information and function information. Class information refers to the detailed information of the Java class associated with the data to be processed, for example, including the full name of the class. Function information indicates the name of the function to be called when processing the data to be processed. The class (interface) information and function information of the processing data will also be reported. The application platform can load the corresponding class based on this information and call the correct function to process the data to meet specific business needs.
[0083] In one embodiment of the present disclosure, the data to be processed may be sensor data collected by the terminal device through a sensor, generated after preprocessing and formatting, and the data to be processed includes at least sensor data, class information and function information.
[0084] In one embodiment of the present disclosure, the open platform creates a physical model, which includes data to be processed, and the data to be processed includes at least sensor data, class information and function information. At the same time, the open platform is also equipped with a rule engine, which processes the data to be processed according to predefined rules and can forward the processed data to the application platform.
[0085] Specifically, in the application scenarios of the Internet of Things, object models are usually used to describe the properties, states, and behaviors of devices, sensors, or other physical entities. Creating an object model means defining one or more data structures that can accommodate the data to be processed. These data structures may include fields, attributes, or variables to store different types of data (such as temperature, humidity, pressure values, etc.).
[0086] Once the object model is created, it can serve as the basis for data transmission and processing. The data to be processed can be organized and packaged according to the structure of the object model for subsequent forwarding and processing. The rule engine is a software component that performs decisions or actions based on a predefined set of rules. In the process of data forwarding, the rule engine is used to determine when, where, and how to forward the data to be processed. When a certain condition is met, the rule engine triggers the corresponding action. Then the data to be processed is forwarded to the application platform. The forwarding process may involve sending the data to a specific endpoint, using a specific protocol or format, or performing necessary data conversion or encryption. These operations all depend on the configuration of the rule engine and the definition of the rules. In this way, creating the object model and using the rule engine can ensure that the data to be processed is forwarded to the application platform in a structured and controlled manner, thereby meeting business needs and ensuring data accuracy and security.
[0087] Figure 5 is another diagram illustrating a data processing method according to an embodiment of the present disclosure.
[0088] like Figure 5 As shown, the data processing method according to the embodiment of the present disclosure includes the following steps.
[0089] In step S501 , sensor data is collected.
[0090] It can be understood that sensor data refers to data collected and generated by various sensor devices.
[0091] In one embodiment of the present disclosure, the terminal device may collect sensor data through sensors.
[0092] In step S502, data to be processed is generated based on the sensor data.
[0093] It is understandable that the terminal device can generate the data to be processed based on the sensor data. When the terminal device collects the sensor data, the sensor data can be pre-processed and formatted to generate the data to be processed, wherein the data to be processed includes at least class information and function information. The data to be processed can be used for various business analysis tasks.
[0094] In step S503, the data to be processed is sent to the open platform for processing; wherein the data to be processed at least includes class information and function information.
[0095] In one embodiment of the present disclosure, when the terminal device generates data to be processed, the data to be processed will be sent to the open platform for processing the data to be processed. The data to be processed includes at least class information and function information. Class information refers to the detailed information of the Java class associated with the data to be processed, for example, including the full name of the class. Function information indicates the name of the function to be called when processing the data to be processed. Class (interface) information and function information of the processing data will also be reported.
[0096] The data processing method according to the embodiment of the present disclosure is described above. The data processing device 600 for implementing the above data processing method will be further described below.
[0097] Figure 6 is a schematic diagram illustrating a data processing device 600 according to an embodiment of the present disclosure, such as Figure 6 As shown, the device may include a data receiving unit 601, a first type information determining unit 602, a class instance judging unit 603, a first data processing unit 604 and a second data processing unit 605.
[0098] Specifically, the data receiving unit 601 is configured to receive data to be processed, wherein the data to be processed at least includes class information and function information;
[0099] Specifically, the first type of information determining unit 602 is configured to determine the first type of information corresponding to the data to be processed based on the reflection mechanism;
[0100] Specifically, the class instance determination unit 603 is configured to determine whether there is a class instance corresponding to the first type of information based on the first type of information;
[0101] Specifically, the first data processing unit 604 is configured to create a class instance corresponding to the first type of information when there is no class instance, and call a function corresponding to the class instance to process the data to be processed;
[0102] Specifically, the second data processing unit 605 is configured to, when there is a class instance, call a function corresponding to the class instance to process the data to be processed.
[0103] Figure 7 1 is a hardware block diagram of an electronic device 700 according to an embodiment of the present disclosure. The electronic device according to an embodiment of the present disclosure includes at least a processor; and a memory for storing computer-readable instructions. When the computer-readable instructions are loaded and executed by the processor, the processor executes the data processing method as described above.
[0104] Figure 7The electronic device 700 shown specifically includes: a central processing unit (CPU) 701, a graphics processing unit (GPU) 702 and a memory 703. These units are interconnected via a bus 704. The central processing unit (CPU) 701 and / or the graphics processing unit (GPU) 702 can be used as the above-mentioned processor, and the memory 703 can be used as the above-mentioned memory for storing computer-readable instructions. In addition, the electronic device 700 may also include a communication unit 705, a storage unit 706, an output unit 707, an input unit 708 and an external device 709, which are also connected to the bus 704.
[0105] Figure 8 is a schematic diagram illustrating a computer program product according to an embodiment of the present disclosure. Figure 8 As shown, a computer program product 800 according to an embodiment of the present disclosure has a computer program 801 stored thereon. When the computer program is executed by a processor, the data processing as described above is implemented. Computer program products include, but are not limited to, system software, application software, and games. System software is the basic software of a computer, which is responsible for managing the hardware and application programs of the computer, including an operating system, device drivers, etc. Application software is software designed to meet specific needs, such as office software, image processing software, etc. Games are software used for entertainment, providing a variety of gaming experiences. In addition, computer program products may also include embedded software, firmware, etc., for controlling and operating various hardware devices.
[0106] Fig. 9 is a schematic diagram illustrating a computer-readable storage medium according to an embodiment of the present disclosure. Fig. 9 As shown, a computer-readable storage medium 900 according to an embodiment of the present disclosure has computer-readable instructions 901 stored thereon. When the computer-readable instructions 901 are executed by a processor, the data processing method according to the embodiment of the present disclosure described with reference to the above figures is executed. The computer-readable storage medium includes, but is not limited to, for example, volatile memory and / or non-volatile memory. The volatile memory may, for example, include a random access memory (RAM) and / or a cache memory (cache), etc. The non-volatile memory may, for example, include a read-only memory (ROM), a hard disk, a flash memory, an optical disk, a magnetic disk, etc.
[0107] The data processing method, device, electronic device, computer program product and computer-readable storage medium according to the embodiments of the present disclosure are described above with reference to the accompanying drawings. The present disclosure utilizes the Java reflection mechanism to dynamically determine how to process different data to be processed when processing data, without the need to write fixed code logic in advance. This enables the system to more easily adapt to changing business needs, reduces maintenance costs, and improves data processing efficiency.
[0108] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this disclosure.
[0109] The basic principles of the present disclosure are described above in conjunction with specific embodiments. However, it should be noted that the advantages, strengths, effects, etc. mentioned in the present disclosure are only examples and not limitations, and it cannot be considered that these advantages, strengths, effects, etc. are required by each embodiment of the present disclosure. In addition, the specific details disclosed above are only for the purpose of illustration and ease of understanding, and are not limitations. The above details do not limit the present disclosure to the necessity of adopting the above specific details to be implemented.
[0110] The block diagrams of the devices, apparatuses, equipment, and systems involved in this disclosure are only illustrative examples and are not intended to require or imply that they must be connected, arranged, and configured in the manner shown in the block diagrams. As will be appreciated by those skilled in the art, these devices, apparatuses, equipment, and systems can be connected, arranged, and configured in any manner. Words such as "including," "comprising," "having," and the like are open words, referring to "including but not limited to," and can be used interchangeably therewith. The words "or" and "and" used herein refer to the words "and / or," and can be used interchangeably therewith, unless the context clearly indicates otherwise. The word "such as" used herein refers to the phrase "such as but not limited to," and can be used interchangeably therewith.
[0111] Additionally, as used herein, "or" used in a list of items beginning with "at least one" indicates a separate list, so that, for example, a list of "at least one of A, B, or C" means A or B or C, or AB or AC or BC, or ABC (i.e., A and B and C). Furthermore, the word "exemplary" does not mean that the example described is preferred or better than other examples.
[0112] It should also be noted that in the system and method of the present disclosure, each component or each step can be decomposed and / or recombined. Such decomposition and / or recombination should be regarded as equivalent solutions of the present disclosure.
[0113] Various changes, substitutions, and modifications of the technology herein may be made without departing from the technology of the teachings defined by the appended claims. Furthermore, the scope of the claims of the present disclosure is not limited to the specific aspects of the above processes, machines, manufactures, compositions of events, means, methods, and actions. Currently existing or later to be developed processes, machines, manufactures, compositions of events, means, methods, or actions that perform substantially the same functions or achieve substantially the same results as the corresponding aspects herein may be utilized. Thus, the appended claims include such processes, machines, manufactures, compositions of events, means, methods, or actions within their scope.
[0114] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of the present disclosure. Therefore, the present disclosure is not intended to be limited to the aspects shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
[0115] The above description has been given for the purpose of illustration and description. In addition, this description is not intended to limit the embodiments of the present disclosure to the forms disclosed herein. Although multiple example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, changes, additions and sub-combinations thereof.
Claims
1. A data processing method, characterized in that: include: Receiving data to be processed, wherein the data to be processed at least includes class information and function information; Determine, based on a reflection mechanism, a first type of information corresponding to the data to be processed; Based on the first category of information, determining whether there is a class instance corresponding to the first category of information; When there is no class instance, creating a class instance corresponding to the first type of information, and calling a function corresponding to the class instance to process the data to be processed; When there is the class instance, the function corresponding to the class instance is called to process the data to be processed.
2. The data processing method according to claim 1, characterized in that: The determining, based on a reflection mechanism, the first type of information corresponding to the data processing comprises: Based on the reflection mechanism, the class information is parsed to determine the first class information related to the data to be processed.
3. The data processing method according to claim 1, characterized in that: When the class instance does not exist, creating a class instance corresponding to the first type of information, and calling the second function information corresponding to the class instance to perform the data processing, includes: Based on the first type of information, obtaining a class object; Based on the class object, create a class instance corresponding to the class object; Based on the class object, a function corresponding to the class instance is called to process the data to be processed.
4. The data processing method according to claim 1, characterized in that: When the class instance exists, calling the function information corresponding to the class instance to perform the data processing includes: Based on the first type of information, obtaining a class object; Based on the class object, a function corresponding to the class instance is called to process the data to be processed.
5. A data processing method, characterized in that: include: receiving data to be processed from a terminal device; forwarding the data to be processed to an application platform for processing the data to be processed; The data to be processed at least includes class information and function information.
6. A data processing method, characterized in that: include: Collect sensor data; Based on the sensor data, generating data to be processed; Sending the data to be processed to an open platform for processing the data to be processed; The data to be processed at least includes class information and function information.
7. A data processing device, characterized in that: include: A data receiving unit, configured to receive data to be processed, wherein the data to be processed at least includes class information and function information; A first type of information determining unit, configured to determine the first type of information corresponding to the data to be processed based on a reflection mechanism; a class instance determination unit, configured to determine whether there is a class instance corresponding to the first type of information based on the first type of information; A first data processing unit is configured to create a class instance corresponding to the first type of information when there is no class instance, and call a function corresponding to the class instance to process the data to be processed; The second data processing unit is configured to call the function corresponding to the class instance to process the data to be processed when there is the class instance.
8. An electronic device, characterized in that: include: a memory for storing computer readable instructions; as well as A processor is used to run the computer-readable instructions so that the electronic device performs the data processing method according to any one of claims 1 to 6.
9. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the data processing method according to any one of claims 1 to 6 is implemented.
10. A computer-readable storage medium for storing computer-readable instructions, characterized in that: When the computer-readable instructions are executed by a processor, the processor is caused to perform the data processing method according to any one of claims 1 to 6.
