code example in README.md
This commit is contained in:
parent
27167b58fa
commit
e493ad32a0
1 changed files with 19 additions and 19 deletions
38
README.md
38
README.md
|
|
@ -5,24 +5,24 @@ project status: early stage
|
||||||
* At this moment a complete compile cycle is guaranteed (unittested) for a really simple class.
|
* At this moment a complete compile cycle is guaranteed (unittested) for a really simple class.
|
||||||
|
|
||||||
```
|
```
|
||||||
BeeSource createEmptyClass() throws ClassNotFoundException {
|
BeeSource createEmptyClass() {
|
||||||
return BeeSource.builder()
|
return BeeSource.builder()
|
||||||
.withClassFileVersion(Version.V14)
|
.withClassFileVersion(Version.V14)
|
||||||
.withPackage("nl.sander.beejava.test")
|
.withPackage("nl.sander.beejava.test")
|
||||||
.withAccessFlags(PUBLIC, SUPER)
|
.withAccessFlags(PUBLIC, SUPER)
|
||||||
.withSimpleName("EmptyBean")
|
.withSimpleName("EmptyBean")
|
||||||
.withSuperClass(Object.class) // Not mandatory, like in java sourcecode
|
.withSuperClass(Object.class) // Not mandatory, like in java sourcecode
|
||||||
.withConstructors(createDefaultConstructor()) // There's no default constructor in beejava. The user must always add them
|
.withConstructors(createDefaultConstructor()) // There's no default constructor in beejava. The user must always add them
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
BeeConstructor createDefaultConstructor() throws ClassNotFoundException {
|
BeeConstructor createDefaultConstructor() {
|
||||||
return BeeConstructor.builder()
|
return BeeConstructor.builder()
|
||||||
.withAccessFlags(MethodAccessFlags.PUBLIC)
|
.withAccessFlags(MethodAccessFlags.PUBLIC)
|
||||||
.withCode(
|
.withCode(
|
||||||
line(0, LD_VAR, Ref.THIS),
|
line(0, LD_VAR, Ref.THIS),
|
||||||
line(1, INVOKE, Ref.SUPER, "<init>", "()"),
|
line(1, INVOKE, Ref.SUPER, "<init>", "()"),
|
||||||
line(5, RETURN))
|
line(5, RETURN))
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
Loading…
Add table
Reference in a new issue