objectos :: code :: pojo

Java source code abstraction. One API, many sources.

License

License

GroupId

GroupId

br.com.objectos
ArtifactId

ArtifactId

code-pojo
Last Version

Last Version

0.5.0
Release Date

Release Date

Type

Type

jar
Description

Description

objectos :: code :: pojo
Java source code abstraction. One API, many sources.
Project Organization

Project Organization

Objectos Software LTDA

Download code-pojo

How to add to project

<!-- https://jarcasting.com/artifacts/br.com.objectos/code-pojo/ -->
<dependency>
    <groupId>br.com.objectos</groupId>
    <artifactId>code-pojo</artifactId>
    <version>0.5.0</version>
</dependency>
// https://jarcasting.com/artifacts/br.com.objectos/code-pojo/
implementation 'br.com.objectos:code-pojo:0.5.0'
// https://jarcasting.com/artifacts/br.com.objectos/code-pojo/
implementation ("br.com.objectos:code-pojo:0.5.0")
'br.com.objectos:code-pojo:jar:0.5.0'
<dependency org="br.com.objectos" name="code-pojo" rev="0.5.0">
  <artifact name="code-pojo" type="jar" />
</dependency>
@Grapes(
@Grab(group='br.com.objectos', module='code-pojo', version='0.5.0')
)
libraryDependencies += "br.com.objectos" % "code-pojo" % "0.5.0"
[br.com.objectos/code-pojo "0.5.0"]

Dependencies

compile (2)

Group / Artifact Type Version
br.com.objectos : code-core jar 0.5.0
br.com.objectos : lazy jar 0.2.0

test (3)

Group / Artifact Type Version
br.com.objectos : code-testing jar 0.5.0
br.com.objectos : code-apt jar 0.5.0
br.com.objectos : testing jar 0.1.1

Project Modules

There are no modules declared in this project.

ObjectosCode

Java source code generation and annotation processing library.

Build Status Maven Central GitHub license

Example

The following code:

PackageName examplesPackage = PackageName.named("br.com.objectos.code.examples");
ClassName helloWorld = examplesPackage.nestedClass("HelloWorld");
Identifier obj = id("obj");

MethodCode mainMethod = method(
    _public(), _static(), _void(), id("main"),
    param(a(cn(String.class)), id("args")),

    _var(helloWorld, obj, _new(helloWorld)),
    invoke(obj, "sayHello")
);

MethodCode sayHelloMethod = method(
    _public(), _final(), _void(), id("sayHello"),
    cn(System.class).id("out").invoke("println", invoke("helloMessage"))
);

MethodCode helloMessageMethod = method(
    _private(), cn(String.class), id("helloMessage"),
    _return(l("Hello world!"))
);

ClassCode helloWorldClass = _class(
    _public(), _final(), id("HelloWorld"),
    mainMethod,
    sayHelloMethod,
    helloMessageMethod
);

JavaFile helloWorldFile = javaFile(
    examplesPackage,
    helloWorldClass
);

System.out.println(helloWorldFile.toString());

produces the following output:

package br.com.objectos.code.examples;

public final class HelloWorld {
  
  public static void main(String[] args) {
    HelloWorld obj = new HelloWorld();
    obj.sayHello();
  }
  
  public final void sayHello() {
    System.out.println(helloMessage());
  }

  private String helloMessage() {
    return "Hello world!";
  }

}

Documentation

A proper documentation is on the way.

In the meantime you can browse some examples here.

Maven

objectos::code is at Maven Central.

<dependency>
	<groupId>br.com.objectos.code</groupId>
	<artifactId>code</artifactId>
	<version>0.29.1</version>
</dependency>

License

Copyright (C) 2014-2020 Objectos Software LTDA

Licensed under the GNU Affero General Public License v3.

Notice

This library includes code from other open-source projects. See attached NOTICE.txt.

br.com.objectos

Objectos Software

We craft Java tools.

Versions

Version
0.5.0
0.4.11
0.4.10
0.4.9
0.4.8
0.4.7
0.4.6
0.4.5
0.4.4
0.4.3
0.4.2
0.4.1
0.4.0
0.3.0
0.2.0
0.1.2
0.1.1
0.1.0