CN113176877A - Entity class generation method, device and storage medium - Google Patents

Entity class generation method, device and storage medium Download PDF

Info

Publication number
CN113176877A
CN113176877A CN202110585710.5A CN202110585710A CN113176877A CN 113176877 A CN113176877 A CN 113176877A CN 202110585710 A CN202110585710 A CN 202110585710A CN 113176877 A CN113176877 A CN 113176877A
Authority
CN
China
Prior art keywords
data file
configuration information
file
entity class
entity
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.)
Granted
Application number
CN202110585710.5A
Other languages
Chinese (zh)
Other versions
CN113176877B (en
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.)
Beijing Grela Technology Co ltd
Original Assignee
Beijing Grela Technology Co ltd
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 Beijing Grela Technology Co ltd filed Critical Beijing Grela Technology Co ltd
Priority to CN202110585710.5A priority Critical patent/CN113176877B/en
Publication of CN113176877A publication Critical patent/CN113176877A/en
Application granted granted Critical
Publication of CN113176877B publication Critical patent/CN113176877B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/31Programming languages or programming paradigms
    • G06F8/315Object-oriented languages
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/279Recognition of textual entities
    • G06F40/289Phrasal analysis, e.g. finite state techniques or chunking
    • G06F40/295Named entity recognition

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Computational Linguistics (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • Computing Systems (AREA)
  • Artificial Intelligence (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The disclosure relates to an entity class generation method, an entity class generation device and a storage medium, wherein the method comprises the following steps: when executing a script file, respectively acquiring configuration information of a first data file and a second data file, wherein the file types of the first data file and the second data file are different; comparing the configuration information of the first data file with the configuration information of the second data file, and extracting the configuration information meeting preset conditions; and generating entity classes corresponding to the first data file and the second data file based on the configuration information meeting the preset conditions. According to the method and the device, the configuration information of the first data file and the second data file is obtained, the configuration information meeting the preset conditions is extracted, and the entity class is automatically generated based on the configuration information meeting the preset conditions, so that the process of manually developing codes can be simplified, the development efficiency is improved, the complexity of rear-end development is reduced, redundant fields are reduced, the generation efficiency of the entity class is improved, and errors in the entity class are improved.

Description

Entity class generation method, device and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for generating entity classes, and a storage medium.
Background
The main purpose of an entity class is to store data and provide access to such data. Typically, each configuration table needs to correspond to an entity class. The existing configuration tables usually need to be written manually, each configuration table needs to be written, in addition, a large number of fields exist in the same configuration table, the data types of the fields are different, and errors are easy to generate.
Disclosure of Invention
The present disclosure is intended to provide a method and an apparatus for generating entity classes, and a storage medium, which can solve the technical problems in the prior art that a configuration table needs to be manually written, time and labor are wasted, and a large number of fields in the configuration table are prone to generate errors.
According to one aspect of the present disclosure, there is provided an entity class generation method, including:
when a script file is executed, respectively acquiring configuration information of a first data file and configuration information of a second data file, wherein the file types of the first data file and the second data file are different;
comparing the configuration information of the first data file with the configuration information of the second data file, and extracting the configuration information meeting preset conditions;
and generating entity classes corresponding to the first data file and the second data file based on the configuration information meeting the preset conditions.
In some embodiments, the first data file is a json file and the second data file is an Excel file.
In some embodiments, comparing the configuration information of the first data file with the configuration information of the second data file, and extracting the configuration information meeting a preset condition includes:
and comparing the field name of the first data file with the field name of the second data file, and extracting the same field in the first data file and the second data file.
In some embodiments, generating entity classes corresponding to the first data file and the second data file based on the configuration information that meets the preset condition includes:
constructing a mapping relation between the entity class and the field based on the extracted field;
and generating the corresponding entity class based on the mapping relation.
In some embodiments, the method further comprises:
and generating an access object according to the generated entity class.
In some embodiments, after generating the access object according to the generated entity class, the method further comprises:
assigning values to corresponding attributes in the access objects based on the attribute information in the entity classes to obtain attribute values of the access objects;
and extracting related attribute values in the access object, and executing related operation according to the attribute values.
According to one aspect of the present disclosure, there is also provided an entity class generation apparatus, including:
the file processing device comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is configured to respectively acquire configuration information of a first data file and a second data file when a file script is executed, and the file types of the first data file and the second data file are different;
the extraction module is configured to compare the configuration information of the first data file with the configuration information of the second data file and extract the configuration information meeting preset conditions;
and the generating module is configured to generate entity classes corresponding to the first data file and the second data file based on the configuration information meeting the preset condition.
In some embodiments, the extraction module is specifically configured to:
and comparing the field name of the first data file with the field name of the second data file, and extracting the same field in the first data file and the second data file.
In some embodiments, the generation module is specifically configured to:
constructing a mapping relation between the entity class and the field based on the extracted field;
and generating the corresponding entity class based on the mapping relation.
According to one of the aspects of the present disclosure, a computer-readable storage medium is further provided, on which computer-executable instructions are stored, and when the computer-executable instructions are executed by a processor, the entity class generation method is implemented.
According to the entity class generation method, the entity class generation device and the storage medium of various embodiments disclosed by the invention, the configuration information of the first data file and the second data file is obtained, the configuration information meeting the preset condition is extracted, and the entity class is automatically generated based on the configuration information meeting the preset condition, so that the process of manually developing codes can be simplified, the development efficiency is improved, and the complexity of back-end development is reduced; meanwhile, redundant fields can be reduced, the generation efficiency of the entity class is improved, and errors in the entity class are reduced.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure, as claimed.
Drawings
In the drawings, which are not necessarily drawn to scale, like reference numerals may designate like components in different views. Like reference numerals with letter suffixes or like reference numerals with different letter suffixes may represent different instances of like components. The drawings illustrate various embodiments generally, by way of example and not by way of limitation, and together with the description and claims, serve to explain the disclosed embodiments.
Fig. 1 shows a flowchart of an entity class generation method according to an embodiment of the present disclosure;
fig. 2 shows an architecture diagram of an entity class generation apparatus according to an embodiment of the present disclosure.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be described below clearly and completely with reference to the accompanying drawings of the embodiments of the present disclosure. It is to be understood that the described embodiments are only a few embodiments of the present disclosure, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the described embodiments of the disclosure without any inventive step, are within the scope of protection of the disclosure.
Unless otherwise defined, technical or scientific terms used herein shall have the ordinary meaning as understood by one of ordinary skill in the art to which this disclosure belongs. The word "comprising" or "comprises", and the like, means that the element or item listed before the word covers the element or item listed after the word and its equivalents, but does not exclude other elements or items.
To maintain the following description of the embodiments of the present disclosure clear and concise, a detailed description of known functions and known components have been omitted from the present disclosure.
As one solution, as shown in fig. 1, an embodiment of the present disclosure provides an entity class generation method, including:
s101: when executing a script file, respectively acquiring configuration information of a first data file and a second data file, wherein the file types of the first data file and the second data file are different.
Specifically, the server may obtain a first data file and a second data file when executing the script file, in this embodiment, the first data file is a json file, and the second data file is an Excel file. The first data file is a json format file, the stored data is light-weight, reading and writing are easy, machine analysis and generation are easy, and transmission efficiency can be effectively improved.
The configuration information includes: table name, field type, field length, whether the field is null, field comment, etc.
In some embodiments, prior to executing the script file, the method further comprises: and building a script execution environment by using a script language.
The scripting language comprises languages such as NodeJS, python and php, and in the embodiment, the NodeJS language is used for development, so that the development environment is convenient to build.
S102: and comparing the configuration information of the first data file with the configuration information of the second data file, and extracting the configuration information meeting preset conditions.
In the embodiment of the present disclosure, S102 specifically includes:
and comparing the field name of the first data file with the field name of the second data file, and extracting the same field in the first data file and the second data file.
In one embodiment, the first data file is a.json and the second data file is a.xls.
Json is { "a": 1, "b": 2, "c": 3, wherein "a", "b", and "c" respectively represent field names; 1. 2, 3 are the values of the fields corresponding to the field names, respectively.
The contents in a.xls are shown in table 1, where the first row in a.xls is the header, representing the field name. The second row indicates the field type of the field and the third row indicates the value of the field that the different field possesses.
TABLE 1
a b c d
int int int int
1 2 3 4
After comparing the data of the a.json file with the data of the a.xls file, the same field name and the corresponding field information (e.g., field type, field value, etc.) are extracted, i.e., "a", "b", "c", and "1", "2", and "3" are extracted. When the field type is not restricted by the a.json file, since the field type is restricted by the a.xls, the extracted field type may be determined to be "int".
In this embodiment, when extracting field information, as much as possible, for the same field, the overall field information is extracted to ensure the accuracy of entity class generation.
In other embodiments, the configuration information meeting the preset condition may be configuration information having a certain specific association relationship between the configuration information of the first data file and the configuration information of the second data file, so that the specific configuration information meeting the preset condition may be extracted from the first data file and the second data file.
S103: and generating entity classes corresponding to the first data file and the second data file based on the configuration information meeting the preset conditions.
Step S103 specifically includes the following steps:
s1031: constructing a mapping relation between the entity class and the field based on the extracted field;
s1032: and generating the corresponding entity class based on the mapping relation.
After the same fields in the first data file and the second data file are extracted, the entity type to be generated and attribute information corresponding to the entity type are determined based on the extracted fields, so that a mapping relation between the entity class and the fields is constructed, and the entity class meeting the mapping relation is generated.
The generated entity class includes attributes and methods, wherein the attributes correspond to fields in the data file. The method mainly comprises a getter method and a setter method, wherein the getter method represents value taking, and the setter method represents assignment. The generated class attributes may include types such as List. For example, the attribute names in the entity class may be determined based on the extracted field names.
In this embodiment, the generated Entity class (Entity) includes, but is not limited to, a java class, and the file type of the java class is java.
When the mapping relation between the entity class and the field is constructed, the method further comprises the following steps: the location where the entity class is generated is determined. For example, an entity class storage path (a path for generating java files) may be determined based on the json file path and/or the Excel file path.
The results of generating entity classes using the above a.json and a.xls files are as follows:
Figure BDA0003087256640000061
wherein @ Getter is used for taking values and @ ToString is used for annotation.
As described above, only the fields included in the two files are generated in the generated entity class, so that the number of the fields in the entity class can be effectively reduced, the occupied space of the file memory is reduced when the data file is read into the memory, and the access efficiency is improved. In the generated entity class, the type of the attribute is usually private.
According to the entity class generation method provided by the embodiment of the disclosure, the configuration information meeting the preset condition is extracted by acquiring the configuration information of the first data file and the second data file, and the entity class is automatically generated based on the configuration information meeting the preset condition, so that the process of manually developing codes can be simplified, the development efficiency is improved, and the complexity of back-end development is reduced; meanwhile, redundant fields can be reduced, the generation efficiency of the entity class is improved, and errors in the entity class are reduced. In addition, the entity class generated in the embodiment only maps data, and the accuracy of generating the entity class can be effectively improved.
After the entity class is generated, the entity class can be packaged to determine a package name (package). The same class name may exist under different package names, for example, when there are two types of aenity.
In some embodiments, after generating the entity classes corresponding to the first data file and the second data file, the method further includes:
s104: and generating an access object according to the generated entity class.
In this embodiment, the attribute information of the entity class is converted into a Map set for storage (one mapping is made by Map) through a reflection mechanism of Java, that is, all attributes and methods of any class can be known. Therefore, the entity class can be traversed according to a reflection mechanism of Java to obtain the attributes of the entity class, and then the access object is generated according to the attributes of the entity class, namely, various attribute information in the Java class is mapped into Java objects one by one, and operation can be performed. For any object, any method and attribute of the object can be called; and can change its properties.
The specific generation mode of the access object can be expressed as follows:
Figure BDA0003087256640000071
Figure BDA0003087256640000081
where the @ Resource tag is responsible for injection.
In some embodiments, after generating the access object according to the generated entity class, the method further comprises:
s1051: assigning values to corresponding attributes in the access objects based on the attribute information in the entity classes to obtain attribute values of the access objects;
s1052: and extracting related attribute values in the access object, and executing related operation according to the attribute values.
In some embodiments, the method further comprises:
and when the back-end server is started, automatically loading the generated configuration file of the entity class.
By automatically loading the generated entity class configuration file, the content of the configuration file can be automatically loaded, and the programming efficiency is improved.
As one solution, as shown in fig. 2, an embodiment of the present disclosure provides an entity class generation apparatus, including:
an obtaining module 201, configured to obtain configuration information of a first data file and a second data file respectively when executing a script file, where file types of the first data file and the second data file are different;
an extracting module 202, configured to compare the configuration information of the first data file with the configuration information of the second data file, and extract configuration information meeting a preset condition;
the generating module 203 is configured to generate entity classes corresponding to the first data file and the second data file based on the configuration information meeting the preset condition.
As a specific implementation, the extracting module 202 of this embodiment may be further configured to:
and comparing the field name of the first data file with the field name of the second data file, and extracting the same field in the first data file and the second data file.
As a specific implementation, the generating module 203 of this embodiment may be specifically configured to:
constructing a mapping relation between the entity class and the field based on the extracted field;
and generating the corresponding entity class based on the mapping relation.
As a specific implementation, the generating module 203 of this embodiment may be further configured to: and generating an access object according to the generated entity class.
As a specific implementation, the entity class generation apparatus of this embodiment may further include an operation module configured to:
assigning fields in the entity class to corresponding attributes in the access object;
and extracting related attribute values in the access object, and executing related operation according to the attribute values.
The entity class generation apparatus provided in the embodiment of the present disclosure corresponds to the entity class generation method in the above embodiment, and any optional items in the embodiment of the entity class generation method are also applicable to this embodiment, and are not described in detail here.
The embodiment of the present disclosure further provides a computer-readable storage medium, on which computer-executable instructions are stored, and when the computer-executable instructions are executed by a processor, the method for generating entity classes mainly includes:
when a script file is executed, respectively acquiring configuration information of a first data file and configuration information of a second data file, wherein the file types of the first data file and the second data file are different;
comparing the configuration information of the first data file with the configuration information of the second data file, and extracting the configuration information meeting preset conditions;
and generating entity classes corresponding to the first data file and the second data file based on the configuration information meeting the preset conditions.
In some embodiments, the processor executing the computer-executable instructions may be a processing device including more than one general purpose processing device, such as a microprocessor, Central Processing Unit (CPU), Graphics Processing Unit (GPU), or the like. More specifically, the processor may be a Complex Instruction Set Computing (CISC) microprocessor, Reduced Instruction Set Computing (RISC) microprocessor, Very Long Instruction Word (VLIW) microprocessor, processor running other instruction sets, or processors running a combination of instruction sets. The processor may also be one or more special-purpose processing devices such as an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), a system on a chip (SoC), or the like.
The computer-readable storage medium described above may be memory, such as read-only memory (ROM), random-access memory (RAM), phase-change random-access memory (PRAM), static random-access memory (SRAM), dynamic random-access memory (DRAM), electrically erasable programmable read-only memory (EEPROM), other types of random-access memory (RAM), flash disk or other forms of flash memory, cache, registers, static memory, compact disk read-only memory (CD-ROM), Digital Versatile Disks (DVD) or other optical storage, magnetic cassettes or other magnetic storage devices, or any other possible non-transitory medium that may be used to store information or instructions that may be accessed by a computer device, and so forth.
The computer-executable instructions of embodiments of the present disclosure may be organized into one or more computer-executable components or modules. Aspects of the disclosure may be implemented with any number and combination of such components or modules. For example, aspects of the disclosure are not limited to the specific computer-executable instructions or the specific components or modules illustrated in the figures and described herein. Other embodiments may include different computer-executable instructions or components having more or less functionality than illustrated and described herein.
The above embodiments are merely exemplary embodiments of the present disclosure, which is not intended to limit the present disclosure, and the scope of the present disclosure is defined by the claims. Various modifications and equivalents of the disclosure may occur to those skilled in the art within the spirit and scope of the disclosure, and such modifications and equivalents are considered to be within the scope of the disclosure.

Claims (10)

1. An entity class generation method, comprising:
when a script file is executed, respectively acquiring configuration information of a first data file and configuration information of a second data file, wherein the file types of the first data file and the second data file are different;
comparing the configuration information of the first data file with the configuration information of the second data file, and extracting the configuration information meeting preset conditions;
and generating entity classes corresponding to the first data file and the second data file based on the configuration information meeting the preset conditions.
2. The method of claim 1, wherein the first data file is a json file and the second data file is an Excel file.
3. The method of claim 1, wherein comparing the configuration information of the first data file with the configuration information of the second data file, and extracting the configuration information satisfying a preset condition comprises:
and comparing the field name of the first data file with the field name of the second data file, and extracting the same field in the first data file and the second data file.
4. The method according to claim 3, wherein generating entity classes corresponding to the first data file and the second data file based on the configuration information meeting the preset condition comprises:
constructing a mapping relation between the entity class and the field based on the extracted field;
and generating the corresponding entity class based on the mapping relation.
5. The method of claim 1, wherein the method further comprises:
and generating an access object according to the generated entity class.
6. The method of claim 5, wherein after generating an access object from the generated entity class, the method further comprises:
assigning values to corresponding attributes in the access objects based on the attribute information in the entity classes to obtain attribute values of the access objects;
and extracting related attribute values in the access object, and executing related operation according to the attribute values.
7. An entity class generation apparatus comprising:
the file processing device comprises an acquisition module, a storage module and a processing module, wherein the acquisition module is configured to respectively acquire configuration information of a first data file and a second data file when a file script is executed, and the file types of the first data file and the second data file are different;
the extraction module is configured to compare the configuration information of the first data file with the configuration information of the second data file and extract the configuration information meeting preset conditions;
and the generating module is configured to generate entity classes corresponding to the first data file and the second data file based on the configuration information meeting the preset condition.
8. The apparatus of claim 7, wherein the extraction module is specifically configured to:
and comparing the field name of the first data file with the field name of the second data file, and extracting the same field in the first data file and the second data file.
9. The apparatus of claim 8, wherein the generation module is specifically configured to:
constructing a mapping relation between the entity class and the field based on the extracted field;
and generating the corresponding entity class based on the mapping relation.
10. A computer-readable storage medium having stored thereon computer-executable instructions that, when executed by a processor, implement:
the entity class generation method according to any one of claims 1 to 6.
CN202110585710.5A 2021-05-27 2021-05-27 Entity class generation method, device and storage medium Active CN113176877B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110585710.5A CN113176877B (en) 2021-05-27 2021-05-27 Entity class generation method, device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110585710.5A CN113176877B (en) 2021-05-27 2021-05-27 Entity class generation method, device and storage medium

Publications (2)

Publication Number Publication Date
CN113176877A true CN113176877A (en) 2021-07-27
CN113176877B CN113176877B (en) 2024-08-13

Family

ID=76927567

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110585710.5A Active CN113176877B (en) 2021-05-27 2021-05-27 Entity class generation method, device and storage medium

Country Status (1)

Country Link
CN (1) CN113176877B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114895912A (en) * 2022-06-07 2022-08-12 康键信息技术(深圳)有限公司 Method, device, equipment and medium for converting entity class object under coding architecture

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108241720A (en) * 2016-12-27 2018-07-03 北京京东尚科信息技术有限公司 Data processing method and data processing equipment
WO2018145635A1 (en) * 2017-02-08 2018-08-16 深圳壹账通智能科技有限公司 File generation method, device, server, and storage medium
CN110851129A (en) * 2019-11-13 2020-02-28 深圳市泰洲科技有限公司 Automatic generation method of software system code of data management class

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108241720A (en) * 2016-12-27 2018-07-03 北京京东尚科信息技术有限公司 Data processing method and data processing equipment
WO2018145635A1 (en) * 2017-02-08 2018-08-16 深圳壹账通智能科技有限公司 File generation method, device, server, and storage medium
CN110851129A (en) * 2019-11-13 2020-02-28 深圳市泰洲科技有限公司 Automatic generation method of software system code of data management class

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114895912A (en) * 2022-06-07 2022-08-12 康键信息技术(深圳)有限公司 Method, device, equipment and medium for converting entity class object under coding architecture

Also Published As

Publication number Publication date
CN113176877B (en) 2024-08-13

Similar Documents

Publication Publication Date Title
CN110275709B (en) Processing and optimizing method, device and equipment for dynamic language and storage medium
US9424009B2 (en) Handling pointers in program code in a system that supports multiple address spaces
US11650754B2 (en) Data accessing method, device, and storage medium
CN113791768B (en) Code generation method and device, storage medium and terminal
US20210286795A1 (en) Database index and database query processing method, apparatus, and device
CN108228443B (en) Web application testing method and device
US20230315416A1 (en) Code translation method and apparatus, and device
CN112187713B (en) Message conversion method, device, computer equipment and storage medium
CN113360157A (en) Program compiling method, device and computer readable medium
CN111475150A (en) Cross-language binding method, device, equipment and storage medium
CN113176877B (en) Entity class generation method, device and storage medium
CN111240761A (en) Configuration file loading method and device
CN105867886B (en) Method and device for writing table
CN106874181B (en) Interface conversion verification method and device
CN116700629B (en) Data processing method and device
CN117171030A (en) Method, device, equipment and storage medium for detecting software running environment
CN116861856A (en) Test case format conversion method, device, equipment and readable storage medium
CN111061927A (en) Data processing method and device and electronic equipment
CN116414689A (en) Interface parameter verification method and system based on reflection mechanism
CN113448923B (en) File generation method, device and terminal
EP1183596B1 (en) Generating optimized computer data field conversion routines
CN117075912B (en) Method for program language conversion, compiling method and related equipment
CN116700840B (en) File execution method, device, electronic equipment and readable storage medium
CN117874002A (en) Method and system for heterogeneous data migration
CN118200407A (en) Method and device for generating message codes, computer equipment and readable 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
GR01 Patent grant
GR01 Patent grant