CN114579095A - AspectJ-based AOP development method, device, equipment and medium - Google Patents

AspectJ-based AOP development method, device, equipment and medium Download PDF

Info

Publication number
CN114579095A
CN114579095A CN202210201569.9A CN202210201569A CN114579095A CN 114579095 A CN114579095 A CN 114579095A CN 202210201569 A CN202210201569 A CN 202210201569A CN 114579095 A CN114579095 A CN 114579095A
Authority
CN
China
Prior art keywords
aspectj
section
annotation
program code
code
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210201569.9A
Other languages
Chinese (zh)
Inventor
蔡马坤
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Agricultural Bank of China
Original Assignee
Agricultural Bank of China
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Agricultural Bank of China filed Critical Agricultural Bank of China
Priority to CN202210201569.9A priority Critical patent/CN114579095A/en
Publication of CN114579095A publication Critical patent/CN114579095A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/20Software design
    • G06F8/24Object-oriented
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/36Software reuse
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the invention discloses a development method, a device, equipment and a medium for realizing AOP (automatic optical plane function) based on AspectJ. Wherein, the method is applied to an android system environment; the method comprises the following steps: determining a self-defined annotation according to business requirements; taking the self-defined annotation as an entry point; compiling an AspectJ tangent plane program code based on the AspectJ framework; and injecting the AspectJ section program code into the entry point to complete section-oriented programming of service requirements. According to the technical scheme, the Android system can achieve the purpose of unified management of the patterns in a section-oriented programming mode, and code coupling inside the functional module is reduced, so that code reusability is improved, and the code maintenance difficulty of the functional module is reduced.

Description

AspectJ-based AOP development method, device, equipment and medium
Technical Field
The invention relates to the technical field of computers, in particular to a development method, a development device, development equipment and a development medium for realizing AOP (automatic optical plane function) based on AspectJ.
Background
With the continuous development of computer technology, the interactive services among various application systems are more and more.
The Aspect Oriented Programming (AOP) is currently used in Spring very conveniently and has very powerful functions, but is very limited to be used in Android development.
In the current Android client project development process, the Android client project can be directly configured in a Manifest. However, if a user dynamically applies for a privacy authority in the version of android6.0 or above, this type of authority can be used only after the user is authorized. However, the dynamic application authority can be used in each service module, and the Android system cannot uniformly manage the styles in the current mode, so that the code reusability is low, and the maintenance difficulty is increased.
Disclosure of Invention
The invention provides a development method, a development device, a development equipment and a development medium for realizing AOP (automatic optical plane function) based on AspectJ, which can realize the purpose of unified management style of an Android system in a section-oriented programming mode, and reduce code coupling in a functional module, thereby improving code reusability and reducing code maintenance difficulty of the functional module.
According to one aspect of the invention, a development method for realizing AOP based on AspectJ is provided, and the method is applied to an android system environment and comprises the following steps:
determining a self-defined annotation according to business requirements; taking the self-defined annotation as an entry point;
compiling an AspectJ tangent plane program code based on the AspectJ framework;
and injecting the AspectJ section program code into the entry point to complete section-oriented programming of service requirements.
Optionally, the target element type of the custom annotation includes a construction method and a common method, and the action period of the annotation is compilation-time valid or runtime valid.
Optionally, if the AspectJ section program code uses the attribute of the annotation band, the action period of the annotation is valid at runtime.
Optionally, determining a custom annotation according to a business requirement includes:
creating a class of an AspectJ cut surface, wherein the class of the AspectJ cut surface is annotated by @ Aspect;
creating a function associated with the custom annotation in the class of the AspectJ section;
correspondingly, AspectJ section program code is written based on the AspectJ framework, and comprises the following steps:
and creating a tangent plane function in the class of the AspectJ tangent plane, wherein the annotation label of the tangent plane function is associated with the associated custom annotation function.
Optionally, before writing the AspectJ section program code based on the AspectJ framework, the method further includes:
based on the AspectJ framework, tasks are defined in a construction script of the construction tool to execute AspectJ compilation.
Optionally, the AspectJ section includes: the system comprises a checking authority section, an asynchronous section, a checking network section, a checking login section, a log statistics section, a performance monitoring section, a click jitter prevention section and a temporary unopened section.
According to another aspect of the invention, a development device for realizing AOP based on AspectJ is provided, and the device is applied to an android system environment; the device comprises:
the user-defined annotation determining module is used for determining user-defined annotations according to business requirements; taking the self-defined annotation as an entry point;
the cut plane program code compiling module is used for compiling AspectJ cut plane program codes based on the AspectJ framework;
and the section program code injection module is used for injecting the AspectJ section program code into the entry point so as to complete section-oriented programming of service requirements.
According to another aspect of the present invention, there is provided an electronic apparatus including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to enable the at least one processor to perform an AspectJ-based AOP development method according to any of the embodiments of the present invention.
According to another aspect of the present invention, there is provided a computer readable storage medium storing computer instructions for causing a processor to implement a method for implementing AOP based on AspectJ according to any one of the embodiments of the present invention when executed.
According to the technical scheme of the embodiment of the invention, the user-defined annotation is determined according to the business requirement; taking the self-defined annotation as an entry point; compiling an AspectJ tangent plane program code based on the AspectJ framework; and injecting the AspectJ section program code into the entry point to complete section-oriented programming of service requirements. According to the technical scheme, the Android system can achieve the purpose of unified management of the patterns in a tangent plane programming-oriented mode, and code coupling inside the functional module is reduced, so that code reusability is improved, and the code maintenance difficulty of the functional module is reduced.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present invention, nor do they necessarily limit the scope of the invention. Other features of the present invention will become apparent from the following description.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a flowchart of a development method for implementing AOP based on AspectJ according to an embodiment of the present invention;
FIG. 2 is a schematic structural diagram of a development apparatus for implementing AOP based on AspectJ according to a second embodiment of the present invention;
FIG. 3 is a schematic structural diagram of an electronic device implementing the development method for implementing AOP based on AspectJ according to the third embodiment of the present invention;
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example one
Fig. 1 is a flowchart of an aspect-based AOP development method according to an embodiment of the present invention, where the embodiment is applicable to a case of implementing facet-oriented programming in an android system, and the method may be executed by an aspect-based AOP development device, which may be implemented in a form of hardware and/or software, and may be configured in an electronic device with data processing capability. As shown in fig. 1, the method includes:
s110, determining a custom annotation according to business requirements; and taking the self-defined annotation as an entry point.
The technical scheme of the embodiment can be executed by the background server and is applied to an Android system environment. The AOP is an abbreviation of Aspect organized Programming, and is a technology for realizing unified maintenance of program functions by a precompilation mode and a running-period dynamic proxy in a facet-Oriented Programming mode. The AOP is the continuation of OOP (Object Oriented Programming) and is a hotspot in software development, and all parts of business logic can be isolated by using the AOP, so that the coupling degree between all parts of the business logic is reduced, the reusability of a program is improved, and the development efficiency is improved; AspectJ is a seamless extension of the facet-oriented programming in Java language (Android compliant).
The service requirements can be understood as that all service modules have requirements such as log statistics, dynamic authority control, performance monitoring and the like, and can also be other service requirements. The custom annotation can be defined according to business requirements, and the content or the definition mode of the custom annotation can be different according to different business requirements. A cut-in point may be referred to as Point, and may be understood as an expression that tells the code injection tool where to inject a particular code (i.e., at which Point points a particular Advice needs to be applied). The point of connection is a point at which code insertion is executed in the program, and is, for example, before method invocation, during method invocation, and after method invocation, or before method execution, during method execution, and after method execution. In this embodiment, the Android backend server may determine the custom annotation according to the service requirement, and use the custom annotation as an entry cut.
Specifically, regarding the custom annotation, when the @ interface custom annotation is used, the java. When annotations are defined, no other annotations or interfaces can be inherited. @ interface is used to declare an annotation, each of which actually declares a configuration parameter. The name of the method is the name of the parameter, and the return value type is the type of the parameter (the return value type can only be a basic type, Class, String and enum). Default may be declared for the parameter.
This embodiment defines eight custom annotations, which are: the annotation definition may include @ CheckPermission, @ Async, @ CheckLogin, @ CheckNet, @ Logiger, @ Notopen, @ SingleClick, and @ TimeLog, and may also define other custom annotations as required.
And S120, writing an AspectJ tangent plane program code based on the AspectJ framework.
AspectJ is a seamless extension (Android applicable) of the Java language to the section-oriented programming. The AspectJ cut plane program code may be written based on the AspectJ framework. In this embodiment, the Android backend server may define a task to execute AspectJ compilation depending on the AspectJ framework, and then compile AspectJ section program codes based on the AspectJ framework.
The AspectJ section program code may be a code for implementing a section function, such as a log statistics section, and the AspectJ section program code to be written is a code that can extract log data by insertion point insertion.
S130, injecting the AspectJ cut surface program code into the cut-in point to complete cut surface-oriented programming of service requirements.
The entry point may be based on the customized annotation. In this embodiment, when the Android backend server rewrites a service code, an annotation standard function of a custom annotation may be used on the service function, and when the program is compiled, the AspectJ compiling may inject AspectJ section program codes into corresponding entry points, so as to complete section-oriented programming of service requirements. Only the relational business logic is needed when writing business code. When the program runs, the service function executes each section before and after. For example, the code language for performance monitoring @ TimeLog may be designed as follows:
Figure BDA0003529538120000061
the code will print the time at which the function executes.
Exemplary, check Authority @ CheckPermission
Figure BDA0003529538120000071
The code dynamically applies for positioning authority, and if the user does not allow the authority, the log in the function is not printed out.
According to the technical scheme of the embodiment of the invention, the user-defined annotation is determined according to the business requirement; taking the self-defined annotation as an entry point; compiling an AspectJ tangent plane program code based on the AspectJ framework; and injecting the AspectJ section program code into the entry point to complete section-oriented programming of service requirements. According to the technical scheme, the Android system can achieve the purpose of unified management of the patterns in a tangent plane programming-oriented mode, and code coupling inside the functional module is reduced, so that code reusability is improved, and the code maintenance difficulty of the functional module is reduced.
In this embodiment, optionally, the target element type of the custom annotation includes a construction method and a normal method, and the action period of the annotation is valid at compile time or valid at runtime.
Among them, there are a construction method and a general method in Java. A generic method may be understood as a block of code that performs a specific function. The construction method may be understood as initializing the data of the object. The target element type of the custom annotation in this embodiment is a construction scheme or a common method, and the annotation action period is compilation-time effective or runtime effective. By means of the scheme, the target element type and the action time period of the user-defined annotation are limited, and the user-defined annotation is more convenient to use.
In this embodiment, optionally, if the AspectJ section program code uses the attribute of the annotation strip, the action period of the annotation is valid at runtime.
The attribute of the annotation band may be an attribute such as an annotation band weight or a value. In this embodiment, if the AspectJ section program code uses the attribute of the annotation band, the action period of the annotation is valid when running. Illustratively, if the AspectJ cut plane program code needs to use the annotation band attribute, then the annotation action period is runtime valid. Taking the custom annotation check authority CheckPermission as an example:
Figure BDA0003529538120000081
the AspectJ section program code needs to know the specific authority (value) which the business code needs to apply at runtime, so that the annotation action period is effective at runtime.
By means of the arrangement, when the section program code needs to use the comment band attribute, the comment action time period is effective when the section program code runs, and user-defined comment is more convenient to use.
In this embodiment, optionally, determining the custom annotation according to the business requirement includes: creating a class of an AspectJ cut surface, wherein the class of the AspectJ cut surface is annotated by @ Aspect; creating a function associated with the custom annotation in the class of the AspectJ section; accordingly, the AspectJ cut-plane program code is written based on the AspectJ framework, and comprises the following steps: and creating a tangent plane function in the class of the AspectJ tangent plane, wherein the annotation label of the tangent plane function is associated with the associated custom annotation function.
An Aspect may be a class declaration similar to Java, and may include some Pointcut (entry point) and corresponding Advice (notification). Advice is also the code that needs to be injected into the class bytecode file; there are generally three types of before, after, and around, which are before, after, and in place of the target method.
In the embodiment, the custom annotation is determined according to the business requirement; and writing an AspectJ section program code based on the AspectJ framework according to the self-defined annotation as an entry point. In this embodiment, the Android backend server may create a class of an Aspect cut surface, where the class of the Aspect cut surface is annotated with @ Aspect; creating a function associated with the self-defined annotation in the class of the AspectJ section; and then creating a tangent function in the class of the AspectJ tangent, wherein the annotation label of the tangent function is associated with the associated self-defined annotation function.
Illustratively, the procedure for writing the section program includes the following steps, taking the checking authority section checkpermissionascope as an example:
1. a class of CheckPermissionaSpeect is created, which is annotated with @ Aspect.
2. Creating a function checkPermission (), which uses @ Pointcut ().
@ within (com. mark. aoplibrary. annotation. checkpermission) | @ annotation (com. mark. aoplibrary. annotation. checkpermission) ").
3. Creating an aroundJoinPoint (proceedingJoinPoint joinPoint) function, marking the function by using @ Around ("execution" (| synthetic ×.)) & & checkPermission () "), realizing authority check and authority dynamic application logic inside the function, and executing a business method directly through joinPoint () if an authority user allows or the dynamic application succeeds. If the user does not allow the authority, the user is uniformly prompted that the service cannot be executed without acquiring the authority. In this embodiment, other tangent plane program codes can be implemented by horizontal extension.
According to the scheme, the AspectJ section program code can be written based on the AspectJ framework, the user-defined annotation function is used for writing the service code, and the AspectJ compiling is convenient to insert the corresponding AspectJ section program code into the cut-in point for use during the program compiling.
In this embodiment, optionally, before writing the AspectJ section program code based on the AspectJ framework, the method further includes: based on the AspectJ framework, tasks are defined in a construction script of the construction tool to execute AspectJ compilation.
The construction tool can be Gradle, a JVM-based construction tool, a general and flexible construction tool and an Android project construction tool. In the embodiment, an AspectJ compiling tool can be relied on in a build file of an Android project, and then the AspectJ compiling is executed by defining a task in a Gradle construction script. According to the scheme, the AspectJ compiling can be executed in the Android project through the setting, so that the facet-oriented programming is realized.
In this embodiment, optionally, the AspectJ section includes: the system comprises a checking authority section, an asynchronous section, a checking network section, a checking login section, a log statistics section, a performance monitoring section, a click jitter prevention section and a temporary unopened section.
The checking permission aspect can be understood that the service code is under the aspect, permission checking and dynamic permission application must be executed before the service code is executed, and if the user does not allow permission, the user is uniformly prompted that the user does not acquire permission and cannot execute the service. Asynchronous tangent plane AsyncA spectrum: and the service code is executed in the sub-thread under the asynchronous section, so that a developer does not need to open up the sub-thread in the time-consuming service code. Checking the network section CheckNetAspect can be understood as that the service code is under the section, and before the network request, the network is judged to jump to a no-network page or a network setting page. The log statistics section LoggerAspect can be understood that the business code is under the section, the function name and all parameters of the business function are printed before the business code is executed, and the business function is printed after the business code is executed to return a result. The performance monitoring section timelogestimate can be understood as the time spent by the service code under the section to print the service function after the service code is executed. The anti-click chatter section SingleClickAssiact can be understood as that an interface click event is under the section, repeated click is prevented, and the click event is executed for multiple times. The not-opened section NotOpenAspect may be understood as a function not-opened section, and the service code is not executed under the section, and may uniformly prompt the user that the function is not opened.
According to the scheme, a plurality of annotations can be annotated through self-definition, so that a plurality of AspectJ tangent planes can be used, the Android system can manage styles in a unified mode, coupling is reduced, and code reusability is improved.
Example two
Fig. 2 is a schematic structural diagram of a development apparatus for implementing AOP based on AspectJ according to a second embodiment of the present invention. As shown in fig. 2, the apparatus is applied to an android system environment; the device includes:
a custom annotation determining module 210, configured to determine a custom annotation according to a business requirement; and taking the self-defined annotation as an entry point.
And the section program code writing module 220 is used for writing AspectJ section program codes based on the AspectJ framework.
A tangent plane program code injection module 230, configured to inject the AspectJ tangent plane program code into the entry point, so as to complete tangent plane-oriented programming of service requirements.
Optionally, the target element type of the custom annotation includes a construction method and a common method, and the action period of the annotation is compilation-time valid or runtime valid.
Optionally, if the AspectJ section program code uses the attribute of the annotation band, the action period of the annotation is valid at runtime.
Optionally, the custom annotation determining module 210 is specifically configured to:
creating a class of an AspectJ cut surface, wherein the class of the AspectJ cut surface is annotated by @ Aspect;
creating a function associated with the custom annotation in the class of the AspectJ section;
correspondingly, the tangent plane program code writing module 220 is specifically configured to:
and creating a tangent plane function in the class of the AspectJ tangent plane, wherein the annotation label of the tangent plane function is associated with the associated custom annotation function.
Optionally, the apparatus further comprises:
the AspectJ compiling and executing module is specifically used for defining a task in a construction script of a construction tool to execute AspectJ compiling based on the AspectJ framework before the AspectJ section program code is compiled based on the AspectJ framework.
Optionally, the AspectJ section includes: the system comprises a checking authority section, an asynchronous section, a checking network section, a checking login section, a log statistics section, a performance monitoring section, a click jitter prevention section and a temporary unopened section.
The development device for realizing AOP based on AspectJ provided by the embodiment of the invention can execute the development method for realizing AOP based on AspectJ provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
EXAMPLE III
FIG. 3 illustrates a schematic diagram of an electronic device 10 that may be used to implement an embodiment of the present invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 3, the electronic device 10 includes at least one processor 11, and a memory communicatively connected to the at least one processor 11, such as a Read Only Memory (ROM)12, a Random Access Memory (RAM)13, and the like, wherein the memory stores a computer program executable by the at least one processor, and the processor 11 may perform various suitable actions and processes according to the computer program stored in the Read Only Memory (ROM)12 or the computer program loaded from the storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data necessary for the operation of the electronic apparatus 10 may also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
A number of components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, or the like; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, or the like. The processor 11 performs the various methods and processes described above, such as the development method that implements AOP based on AspectJ.
In some embodiments, the development method for implementing AOP based on AspectJ may be implemented as a computer program tangibly embodied on a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the above-described AspectJ-based AOP development method may be performed. Alternatively, in other embodiments, the processor 11 may be configured by any other suitable means (e.g., by means of firmware) to perform an AspectJ-based AOP development method.
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, Field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be performed. A computer program can execute entirely on a machine, partly on a machine, as a stand-alone software package partly on a machine and partly on a remote machine or entirely on a remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. A computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), Wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service are overcome.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present invention may be executed in parallel, sequentially, or in different orders, and are not limited herein as long as the desired results of the technical solution of the present invention can be achieved.
The above-described embodiments should not be construed as limiting the scope of the invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A development method for realizing AOP based on AspectJ is characterized by being applied to an android system environment; the method comprises the following steps:
determining a self-defined annotation according to business requirements; taking the self-defined annotation as an entry point;
compiling an AspectJ tangent plane program code based on the AspectJ framework;
and injecting the AspectJ section program code into the entry point to complete section-oriented programming of service requirements.
2. The method of claim 1, wherein the target element types of the custom annotation include a construction method and a normal method, and the action period of the annotation is either compile-time valid or runtime valid.
3. The method of claim 2, wherein if the AspectJ cut plane program code uses an annotation strip attribute, then the time period of action of the annotation is valid at runtime.
4. The method of claim 1, wherein determining custom annotations based on business requirements comprises:
creating a class of an AspectJ cut surface, wherein the class of the AspectJ cut surface is annotated by @ Aspect;
creating a function associated with the custom annotation in the class of the AspectJ section;
accordingly, the AspectJ cut-plane program code is written based on the AspectJ framework, and comprises the following steps:
and creating a tangent plane function in the class of the AspectJ tangent plane, wherein the annotation label of the tangent plane function is associated with the associated custom annotation function.
5. The method of claim 1, before writing the AspectJ cut-plane program code based on the AspectJ framework, further comprising:
and defining a task in a construction script of the construction tool to execute AspectJ compiling based on the AspectJ framework.
6. The method of claim 1, wherein the AspectJ section comprises: the system comprises a checking authority section, an asynchronous section, a checking network section, a checking login section, a log statistics section, a performance monitoring section, a click jitter prevention section and a temporary unopened section.
7. A development device for realizing AOP based on AspectJ is characterized in that the device is applied to an android system environment; the device comprises:
the user-defined annotation determining module is used for determining user-defined annotations according to business requirements; taking the self-defined annotation as an entry point;
the cut plane program code compiling module is used for compiling AspectJ cut plane program codes based on the AspectJ framework;
and the section program code injection module is used for injecting the AspectJ section program code into the entry point so as to complete section-oriented programming of service requirements.
8. The apparatus of claim 7, wherein the target element types of the custom annotation include a construction method and a common method, and the action period of the annotation is either compile-time valid or runtime valid.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein the content of the first and second substances,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the AspectJ-based AOP development method of any of claims 1-6.
10. A computer readable storage medium, having stored thereon computer instructions for causing a processor, when executed, to implement the AspectJ-based AOP development method of any one of claims 1-6.
CN202210201569.9A 2022-03-03 2022-03-03 AspectJ-based AOP development method, device, equipment and medium Pending CN114579095A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210201569.9A CN114579095A (en) 2022-03-03 2022-03-03 AspectJ-based AOP development method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210201569.9A CN114579095A (en) 2022-03-03 2022-03-03 AspectJ-based AOP development method, device, equipment and medium

Publications (1)

Publication Number Publication Date
CN114579095A true CN114579095A (en) 2022-06-03

Family

ID=81771595

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210201569.9A Pending CN114579095A (en) 2022-03-03 2022-03-03 AspectJ-based AOP development method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN114579095A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115729526A (en) * 2022-11-29 2023-03-03 北京京航计算通讯研究所 Monomer and micro-service integrated software development method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115729526A (en) * 2022-11-29 2023-03-03 北京京航计算通讯研究所 Monomer and micro-service integrated software development method

Similar Documents

Publication Publication Date Title
CN113010181B (en) Deployment method and device of operators in deep learning framework and electronic equipment
US20240045850A1 (en) Systems and methods for database orientation transformation
CN110489310B (en) Method and device for recording user operation, storage medium and computer equipment
US9043760B2 (en) Creating dynamic interactive views from trace events for performing deterministic performance analysis
CN112148278A (en) Visual block chain intelligent contract framework and intelligent contract development and deployment method
CN108351790B (en) Apparatus, method, and medium for non-monotonic eventual convergence of desired state configurations
CN115168130A (en) Chip testing method and device, electronic equipment and storage medium
CN114579095A (en) AspectJ-based AOP development method, device, equipment and medium
CN114217789A (en) Function component expansion method, device, equipment, storage medium and program product
CN113778849A (en) Method, apparatus, device and storage medium for testing code
CN112925522A (en) Dependency graph generation method, dependency graph generation device, dependency graph generation apparatus, storage medium, and program product
US7487227B2 (en) Scripting engine having a sequencer table and a plurality of secondary tables for network communication software
CN116051031A (en) Project scheduling system, medium and electronic equipment
CN115269431A (en) Interface testing method and device, electronic equipment and storage medium
CN115509531A (en) Micro front end implementation method, device, terminal and storage medium based on front end technology
US11429358B2 (en) Representing asynchronous state machine in intermediate code
CN114996107A (en) Log file updating method, device, equipment, medium and product
CN114174983B (en) Method and system for optimized automatic verification of advanced constructs
CN114168151A (en) Container-based program compiling method and device, electronic equipment and storage medium
US8135943B1 (en) Method, apparatus, and computer-readable medium for generating a dispatching function
CN117270838B (en) Method, device, equipment and medium for generating universal formula script
CN113760356B (en) Differential configuration method, device, equipment and medium of program product
CN115794555A (en) Service log processing method, device, equipment and storage medium
CN115048087A (en) Method, equipment and storage medium for realizing online IDE tool in Kubernetes environment
CN117251160A (en) Code generation method, device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination