org.apache.maven.plugins.annotations.Component Java Examples
The following examples show how to use
org.apache.maven.plugins.annotations.Component.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MojoDescriptorGleaner.java From takari-lifecycle with Eclipse Public License 1.0 | 6 votes |
private void processTypeFields(TypeElement type, MojoDescriptor descriptor) { // non-static fields for (Element member : type.getEnclosedElements()) { if (member instanceof VariableElement) { Parameter parameter = member.getAnnotation(Parameter.class); Component component = member.getAnnotation(Component.class); if (parameter != null && component != null) { // TODO error marker } if (parameter != null) { descriptor.addParameter(toParameterDescriptor((VariableElement) member, parameter)); } else if (component != null) { descriptor.addRequirement(toComponentDescriptor((VariableElement) member, component)); } } } }
Example #2
Source File: MojoDescriptorGleaner.java From takari-lifecycle with Eclipse Public License 1.0 | 5 votes |
private Set<TypeElement> getAnnotatedTypes(RoundEnvironment roundEnv) { Set<TypeElement> types = new HashSet<>(); roundEnv.getElementsAnnotatedWith(Mojo.class).forEach(type -> types.add((TypeElement) type)); addAnnotatedMembers(types, roundEnv, Parameter.class); addAnnotatedMembers(types, roundEnv, Component.class); return types; }
Example #3
Source File: MojoDescriptorGleaner.java From takari-lifecycle with Eclipse Public License 1.0 | 5 votes |
@Override public Set<String> getSupportedAnnotationTypes() { Set<String> types = new HashSet<>(); types.add(Mojo.class.getName()); types.add(Parameter.class.getName()); types.add(Component.class.getName()); return types; }
Example #4
Source File: MojoDescriptorGleaner.java From takari-lifecycle with Eclipse Public License 1.0 | 5 votes |
private MojoRequirement toComponentDescriptor(VariableElement field, Component component) { MojoRequirement result = new MojoRequirement(); result.setFieldName(field.getSimpleName().toString()); result.setRole(getComponentRole(field, component)); result.setRoleHint(component.hint()); return result; }
Example #5
Source File: MojoDescriptorGleaner.java From takari-lifecycle with Eclipse Public License 1.0 | 5 votes |
private String getComponentRole(VariableElement field, Component component) { String role; try { role = component.role().getName(); } catch (MirroredTypeException e) { role = e.getTypeMirror().toString(); } if (!Object.class.getName().equals(role)) { return role; } return getTypeString(field.asType()); }