Interface encapsulation method and system achieving Android JNI reflection

An encapsulation method and encapsulation system technology, applied in program control devices, execution paradigms, etc., can solve the problems of inability to locate directly, difficult to debug, and a large amount of code, so as to achieve efficient, concise and intuitive interface encapsulation, improve development efficiency, and simplify The effect of the interface

Active Publication Date: 2017-03-15
WUHAN DOUYU NETWORK TECH CO LTD
View PDF4 Cites 10 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0004] 1. The call is complicated, the amount of code is too large, and there are a lot of repeated codes;
[0005] 2. It is difficult to write the interface, and it is necessary to write its function signature for each different function, and the function signature is very easy to write errors;
[0006] 3. Difficult to debug, no way to directly locate the problem

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Interface encapsulation method and system achieving Android JNI reflection
  • Interface encapsulation method and system achieving Android JNI reflection

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0019] The present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments.

[0020] Since the reflection in the Java layer is realized by classes such as Class, Method and Field, in order to achieve the consistency of calling methods, the encapsulation method of the present invention is also realized based on these three classes of Class, Method and Field.

[0021] see figure 1 As shown, the embodiment of the present invention provides an interface encapsulation method for implementing Android JNI reflection, comprising the following steps:

[0022] Step S1: complete the function setting of the Reflect module and encapsulate it into a corresponding functional interface. The function of the Reflect module includes binding the Field module, Method module, and Class module of the Native layer to the corresponding components of the Java layer (its functions are similar to For mapping, the purpose is to shield the...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention discloses an interface encapsulation method and system achieving Android JNI reflection, and relates to the technical field of JNI development of an Android system. The method comprises the steps that function set of a Reflect module is completed at first, and a corresponding function interface is formed through encapsulation so as to be provided for a Field module, a Method module and a Class module of a subsequent Native layer for calling; function set of the Field module and Method module of the Native layer is completed, and corresponding function interfaces are formed through encapsulation; at last, function set of a Class module of the Native layer is completed, and a corresponding function interface is formed through encapsulation. According to the interface encapsulation method, the class, object and function of a corresponding Java layer are obtained through a corresponding reflection function of a reflecting Java layer, encapsulation is conducted, it is guaranteed that the Native layer and the Java layer have the same calling mode, more simplified interfaces are provided, debugging is convenient, and various problems of Naive primitive reflexes are solved.

Description

technical field [0001] The invention relates to the technical field of JNI (Java Native Interface, Java local interface) development of the Android system, specifically an interface encapsulation method and system for realizing Android JNI reflection. Background technique [0002] JNI (Java Native Interface) is a programming framework that enables Java programs running on the Java virtual machine to call or be called programs written in other languages ​​(C, C++ or assembly language, etc.) specific to the local hardware and operating system. [0003] At present, in the development process of Android JNI, the Native layer (local language layer, because the Android system is based on the linux kernel, so here the Native layer represents the C / C++ language) is often used to communicate with the code and functions of the Java layer, and the Native layer Layer calls, access to Java layer objects or functions need to be obtained through reflection (in computer science, reflection ...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
Patent Type & Authority Applications(China)
IPC IPC(8): G06F9/44
CPCG06F9/449
Inventor 刘一琛
Owner WUHAN DOUYU NETWORK TECH CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products