Search in sources :

Example 1 with MemberData

use of ilargia.entitas.codeGeneration.plugins.data.MemberData in project Entitas-Java by Rubentxu.

the class EntityIndexDataProvider method createCustomEntityIndexData.

SourceDataFile createCustomEntityIndexData(SourceDataFile data) {
    AnnotationSource annotation = data.getFileContent().getAnnotation(CustomEntityIndex.class);
    setEntityIndexType(data, data.getFileContent().getName());
    isCustom(data, true);
    setEntityIndexName(data, data.getFileContent().getCanonicalName());
    setContextNames(data, Arrays.asList(annotation.getStringValue()));
    List<MethodData> getMethods = data.getFileContent().getMethods().stream().filter(m -> m.isPublic()).filter(m -> m.hasAnnotation(EntityIndexGetMethod.class)).map(m -> new MethodData(m.getReturnType(), m.getName(), m.getParameters().stream().map(p -> new MemberData(p.getType(), p.getName(), p.getAnnotations().size() > 0 ? p.getAnnotations().get(0) : null)).collect(Collectors.toList()), m.getAnnotation(EntityIndexGetMethod.class))).collect(Collectors.toList());
    setCustomMethods(data, getMethods);
    return data;
}
Also used : AnnotationSource(org.jboss.forge.roaster.model.source.AnnotationSource) Arrays(java.util.Arrays) Properties(java.util.Properties) IComponent(ilargia.entitas.api.IComponent) CustomEntityIndex(ilargia.entitas.codeGenerator.annotations.CustomEntityIndex) EntityIndex(ilargia.entitas.codeGenerator.annotations.EntityIndex) FieldSource(org.jboss.forge.roaster.model.source.FieldSource) CodeGeneratorConfig(ilargia.entitas.codeGeneration.config.CodeGeneratorConfig) Collectors(java.util.stream.Collectors) ArrayList(java.util.ArrayList) ICodeGeneratorDataProvider(ilargia.entitas.codeGeneration.interfaces.ICodeGeneratorDataProvider) ContextsDataProvider(ilargia.entitas.codeGeneration.plugins.dataProviders.components.providers.ContextsDataProvider) List(java.util.List) JavaClassSource(org.jboss.forge.roaster.model.source.JavaClassSource) IConfigurable(ilargia.entitas.codeGeneration.interfaces.IConfigurable) EntityIndexGetMethod(ilargia.entitas.codeGenerator.annotations.EntityIndexGetMethod) Collector(java.util.stream.Collector) MemberData(ilargia.entitas.codeGeneration.plugins.data.MemberData) MethodData(ilargia.entitas.codeGeneration.plugins.data.MethodData) EntityIndexGetMethod(ilargia.entitas.codeGenerator.annotations.EntityIndexGetMethod) AnnotationSource(org.jboss.forge.roaster.model.source.AnnotationSource) MethodData(ilargia.entitas.codeGeneration.plugins.data.MethodData) MemberData(ilargia.entitas.codeGeneration.plugins.data.MemberData)

Aggregations

IComponent (ilargia.entitas.api.IComponent)1 CodeGeneratorConfig (ilargia.entitas.codeGeneration.config.CodeGeneratorConfig)1 ICodeGeneratorDataProvider (ilargia.entitas.codeGeneration.interfaces.ICodeGeneratorDataProvider)1 IConfigurable (ilargia.entitas.codeGeneration.interfaces.IConfigurable)1 MemberData (ilargia.entitas.codeGeneration.plugins.data.MemberData)1 MethodData (ilargia.entitas.codeGeneration.plugins.data.MethodData)1 ContextsDataProvider (ilargia.entitas.codeGeneration.plugins.dataProviders.components.providers.ContextsDataProvider)1 CustomEntityIndex (ilargia.entitas.codeGenerator.annotations.CustomEntityIndex)1 EntityIndex (ilargia.entitas.codeGenerator.annotations.EntityIndex)1 EntityIndexGetMethod (ilargia.entitas.codeGenerator.annotations.EntityIndexGetMethod)1 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 List (java.util.List)1 Properties (java.util.Properties)1 Collector (java.util.stream.Collector)1 Collectors (java.util.stream.Collectors)1 AnnotationSource (org.jboss.forge.roaster.model.source.AnnotationSource)1 FieldSource (org.jboss.forge.roaster.model.source.FieldSource)1 JavaClassSource (org.jboss.forge.roaster.model.source.JavaClassSource)1