org.apache.maven.plugins.annotations.Parameter Java Examples
The following examples show how to use
org.apache.maven.plugins.annotations.Parameter.
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: ResourceMojo.java From jkube with Eclipse Public License 2.0 | 6 votes |
private void resolveTemplateVariablesIfAny(KubernetesList resources) throws MojoExecutionException { Template template = findTemplate(resources); if (template != null) { List<io.fabric8.openshift.api.model.Parameter> parameters = template.getParameters(); if (parameters == null || parameters.isEmpty()) { return; } File kubernetesYaml = new File(this.targetDir, "kubernetes.yml"); resolveTemplateVariables(parameters, kubernetesYaml); File kubernetesResourceDir = new File(this.targetDir, "kubernetes"); File[] kubernetesResources = kubernetesResourceDir.listFiles((dir, filename) -> filename.endsWith(".yml")); if (kubernetesResources != null) { for (File kubernetesResource : kubernetesResources) { resolveTemplateVariables(parameters, kubernetesResource); } } } }
Example #2
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 #3
Source File: MojoDescriptorGleaner.java From takari-lifecycle with Eclipse Public License 1.0 | 6 votes |
private MojoParameter toParameterDescriptor(VariableElement field, Parameter parameter) { MojoParameter result = new MojoParameter(); result.setName(field.getSimpleName().toString()); if (!isEmpty(parameter.alias())) { result.setAlias(parameter.alias()); } if (!isEmpty(parameter.defaultValue())) { result.setDefaultValue(parameter.defaultValue()); } if (!isEmpty(parameter.property())) { result.setExpression("${" + parameter.property() + "}"); } result.setEditable(!parameter.readonly()); result.setRequired(parameter.required()); result.setType(getTypeString(field.asType())); result.setDescription(getDescription(field)); return result; }
Example #4
Source File: AbstractGenerateOsgiManifestMojo.java From vespa with Apache License 2.0 | 5 votes |
private static Optional<String> getVersionThrowOthers(List<ExportPackages.Parameter> parameters) { if (parameters.size() == 1 && "version".equals(parameters.get(0).getName())) { return Optional.of(parameters.get(0).getValue()); } else if (parameters.size() == 0) { return Optional.empty(); } else { List<String> paramNames = parameters.stream().map(ExportPackages.Parameter::getName).collect(Collectors.toList()); throw new RuntimeException("A single, optional version parameter expected, but got " + paramNames); } }
Example #5
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 #6
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 #7
Source File: ComponentManagerBasedMojo.java From component-runtime with Apache License 2.0 | 4 votes |
protected Stream<java.lang.reflect.Parameter> findInputs(final Method listener) { return Stream .of(listener.getParameters()) .filter(p -> p.isAnnotationPresent(Input.class) || !p.isAnnotationPresent(Output.class)); }