Commit 1fb2a0e3 authored by Daniel Bluhm's avatar Daniel Bluhm

Simplify DataElementProcessor

Signed-off-by: Daniel Bluhm's avatarDaniel Bluhm <bluhmdj@ornl.gov>
parent 0299636f
......@@ -33,7 +33,6 @@ import javax.tools.Diagnostic;
import org.eclipse.ice.dev.annotations.DataElement;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.auto.service.AutoService;
/**
......@@ -79,30 +78,30 @@ public class DataElementProcessor extends AbstractProcessor {
*/
protected Elements elementUtils;
/**
* For the extraction of key data from Spec classes used in class generation
*/
protected DataElementExtractor extractor;
@Override
public synchronized void init(final ProcessingEnvironment env) {
this.messager = env.getMessager();
this.elementUtils = env.getElementUtils();
this.extractor = DataElementExtractor.builder()
.elementUtils(elementUtils)
.dataFieldExtractor(new DataFieldExtractor(elementUtils))
.build();
super.init(env);
}
@Override
public boolean process(final Set<? extends TypeElement> annotations, final RoundEnvironment roundEnv) {
// Initialize extractors
// TODO Move this to a service?
DataElementExtractor dataElementExtractor = DataElementExtractor.builder()
.elementUtils(elementUtils)
.dataFieldExtractor(new DataFieldExtractor(elementUtils))
.build();
PersistenceExtractor persistenceExtractor = new PersistenceExtractor();
// Iterate over all elements with DataElement Annotation
for (final Element elem : roundEnv.getElementsAnnotatedWith(DataElement.class)) {
try {
DataElementMetadata data = this.extractor.extract(elem);
DataElementMetadata data = dataElementExtractor.extract(elem);
Optional<PersistenceMetadata> persistence =
new PersistenceExtractor().extractIfApplies(elem);
persistenceExtractor.extractIfApplies(elem);
Set<WriterGenerator> generators = WriterGeneratorFactory.create(
data,
persistence
......
......@@ -9,6 +9,7 @@
* Michael Walsh - Initial implementation
* Daniel Bluhm - Modifications
*******************************************************************************/
package org.eclipse.ice.dev.annotations.processors;
import java.util.ArrayList;
......@@ -20,8 +21,7 @@ import org.slf4j.LoggerFactory;
import lombok.AllArgsConstructor;
/**
* Uses metadata extracted from spec classes annotated with @DataElement to
* generate the interface, implementation, and persistence handler.
* Get list of generated file writers for DataElement annotations.
*
* @author Michael Walsh
* @author Daniel Bluhm
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment