Skip to main content

A java class file operate tools

Project description

java-coder

java-coder is a python tool to operate Java source code. It provides a series of ways to parse, modified and rebuild Java source code based on javalang, targeting Java 8.

the following gives a brief examples to use java-coder.

Getting Started

from javacoder.core import operator
op = operator.ClassOperator(class_path="your_class_path")
op.preview_class()

this will load java source code from the java file and parse the code and show them.

from javacoder.core.builder import ClassBuilder
builder=ClassBuilder("DemoClass")
builder.field("test1",annotation='JSONField',name="111")
builder.field("hello")
builder.extend("ExtendClass")
builder.implement("Implement1")
builder.implement("Implement2")
builder.add_fields_getter_and_setter()
builder.document("this is a test document")
builder.annotation("AnnotationDemo2")
builder.annotation("AnnotationDemo")
builder.imports("com.path")
builder.build().preview_class()

java-coder provides builder tools to create a new class file easily.

from javacoder.core.builder import InterfaceBuilder
project_path='your project path'
builder=InterfaceBuilder("DemoClass")
builder.author()
builder.project(project_path)
builder.extend("Implement1","JPA_DO")
builder.extend("Header")
builder.document("this is a test interface")
builder.annotation("AnnotationDemo2")
builder.annotation("AnnotationDemo")
builder.method("hello")
builder.imports("com.path")
builder.imports("com.path2",wildcard=True)
builder.build().preview_class()

java-coder also provides some useful plugins to generate some infos automatically. It also supports you to apply your own plugin.

Useful tools

java-coder gives some useful tools to make every java coder work easily in daily work.

from javacoder.core import operator
from javacoder.utils import generator
op = operator.ClassOperator(class_path="your_class_path")
ddl_gen = generator.convert_class_fields_to_db_ddl_builder("table_name")
print(ddl_gen(class_fields=[i.declarators[0].name for i in op.get_fields()]))

this will help you generate ddl according to class fields.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

java_coder-0.0.1.tar.gz (12.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

java_coder-0.0.1-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file java_coder-0.0.1.tar.gz.

File metadata

  • Download URL: java_coder-0.0.1.tar.gz
  • Upload date:
  • Size: 12.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for java_coder-0.0.1.tar.gz
Algorithm Hash digest
SHA256 8fbb36158ab647c20c0e95e2dc6052b7f01a64e340ee52993dbfba17dd79f380
MD5 54f07364dd7cb4939b53e810e3722ef5
BLAKE2b-256 aaf87856229f6126e45b56508401bcc27ae52a00661a370bcd248d75d00ec78a

See more details on using hashes here.

File details

Details for the file java_coder-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: java_coder-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 15.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.6

File hashes

Hashes for java_coder-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ebebddf48b86a1ec0a2712800fc3b1f644f95a7c245b0a73c0dd86439b5ddbe5
MD5 b6a2bdf23b44c67606b4fb4c0be93ed9
BLAKE2b-256 11b5a9b2c17f119109cd80d263f84b02166a4679c82edf76f40afc0ef119f0be

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page