Graalvm Annotations


License

License

Categories

Categories

Graal ORM Data
GroupId

GroupId

com.formkiq
ArtifactId

ArtifactId

graalvm-annotations
Last Version

Last Version

1.0.0
Release Date

Release Date

Type

Type

pom.sha512
Description

Description

Graalvm Annotations
Graalvm Annotations
Project URL

Project URL

https://github.com/formkiq/graalvm-annotations
Source Code Management

Source Code Management

https://github.com/formkiq/graalvm-annotations.git

Download graalvm-annotations

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

Graalvm Annotations

License

Java Annotations for generating Graalvm ReflectionConfigurationFiles (https://github.com/oracle/graal/blob/master/substratevm/Reflection.md).

Can be used in combination with Gradle Graalvm Annotation Processor.

Annotation Description
@Reflectable Can be applied to a class add the class to Graalvm's list of reflection classes to process, (based on https://github.com/oracle/graal/blob/master/substratevm/Reflection.md).
@ReflectableClass Manually configure Graalvm reflection class (based on https://github.com/oracle/graal/blob/master/substratevm/Reflection.md). Can be used on any class you cannot apply the @Reflectable annotation to.
@ReflectableClasses List of ReflectableClass definitions.
@ReflectableField Used with @ReflectableClass to define Graalvm reflection for a class field.
@ReflectableMethod Used with @ReflectableClass to define Graalvm reflection for a class method.
@ReflectableImport Import existing Graalvm 'ReflectionConfigurationFiles' File.

Maven Installation

Add the following to your pom.xml

    <dependency>
        <groupId>com.formkiq</groupId>
        <artifactId>graalvm-annotations</artifactId>
        <version>1.0.0</version>
        <!-- Replace 1.0.0 with the version you want to use -->
    </dependency>

Gradle Installation

Add the following to your build.gradle

   implementation group: 'com.formkiq', name: 'graalvm-annotations', version:'1.0.0'
   <!-- Replace 1.0.0 with the version you want to use -->

@Reflectable Example

TestObject.java

@Reflectable
class TestObject {

  /** Preset Key. */
  @Reflectable
  private String id;
}

@ReflectableClasses / @ReflectableClass Example

TestObject.java

class TestObject {
  private String foo;
  public void bar(String s) {}
}

Test.java

@ReflectableClasses({
  @ReflectableClass(
    className=TestObject.class,
    allDeclaredConstructors=false,
    fields = {@ReflectableField(allowWrite = true, name = "foo")},
    methods = {@ReflectableMethod(name = "bar", parameterTypes = {"java.lang.String"})}
  )
})
class Test { }

@ReflectableImport classes Example

Test.java

@Reflectable
class TestObject {
  /** Preset Key. */
  @Reflectable
  private String id;
}
@ReflectableImport(classes = {TestObject.class})
class Test { }

@ReflectableImport file Example

test.json

[
  {
    "name": "sample.Test",
    "allDeclaredConstructors": true,
    "allPublicConstructors": true,
    "allDeclaredMethods": true,
    "allPublicMethods": true,
    "fields": [
      {
        "name": "foo"
      }
    ],
    "methods": [
      {
        "name": "bar",
        "parameterTypes": [
          "int"
        ]
      }
    ]
  }
]
}

Test.java

@ReflectableImport(files="test.json")
class Test { }
com.formkiq

Versions

Version
1.0.0