public interface MetadataGenerator
Represents a generator, that produces resources during compilation phase. User must implement this interface and bind this implementation to a method that would read resources at runtime.
Here is the full workflow:
MetadataProvider annotation.
This method must be declared as native, otherwise compiler should throw an exception.MetadataGenerator instance with the no-arg constructor
If no such constructor exists, compiler throws exception.generateMetadata(MetadataGeneratorContext, MethodReference) method
ands gets the produced resource.MetadataProvider, that
will return the generated resource in run time.Therefore, the type of the value, returned by the
generateMetadata(MetadataGeneratorContext, MethodReference)
method must match the returning type of the appropriate method, marked with MetadataProvider.
The valid resource types are the following:
Resource annotation. Read the description of this interface
for detailed description about valid resources interfaces.ResourceArray of valid resources.ResourceMap of valid resources.null value.All other types are not considered to be resources and therefore are not accepted.
ClassScopedMetadataGenerator| Modifier and Type | Method and Description |
|---|---|
Resource |
generateMetadata(MetadataGeneratorContext context,
org.teavm.model.MethodReference method)
Generates resources, that will be available at runtime.
|
Resource generateMetadata(MetadataGeneratorContext context, org.teavm.model.MethodReference method)
Generates resources, that will be available at runtime.
context - context that contains useful compile-time information.method - method which will be used to access the generated resources at run time.Copyright © 2017. All rights reserved.