List of usage examples for javax.lang.model.element VariableElement getAnnotation
@Override
<A extends Annotation> A getAnnotation(Class<A> annotationType);
From source file:org.mule.devkit.generation.mule.studio.editor.VariableComparator.java
private String extractName(VariableElement variableElement) { if (variableElement.getAnnotation(FriendlyName.class) != null) { return variableElement.getAnnotation(FriendlyName.class).value(); } else {//from www . ja v a 2 s . c o m return variableElement.getSimpleName().toString(); } }
From source file:cop.raml.processor.rest.SpringRestImpl.java
@Override public boolean isBody(@NotNull VariableElement var) { return var.getAnnotation(RequestBody.class) != null; }
From source file:cop.raml.processor.rest.SpringRestImpl.java
@Override public boolean isUriParam(@NotNull VariableElement var) { return var.getAnnotation(PathVariable.class) != null; }
From source file:cop.raml.processor.rest.SpringRestImpl.java
@Override public boolean isQueryParam(@NotNull VariableElement var) { return var.getAnnotation(RequestParam.class) != null; }
From source file:org.mule.devkit.module.generation.LifecycleAdapterFactoryGenerator.java
private void generateFields(Element element, DefinedClass lifecycleAdapterFactory) { java.util.List<VariableElement> variables = ElementFilter.fieldsIn(element.getEnclosedElements()); for (VariableElement variable : variables) { Configurable configurable = variable.getAnnotation(Configurable.class); if (configurable == null) continue; FieldVariable configField = lifecycleAdapterFactory.field(Modifier.PRIVATE, ref(variable.asType()), variable.getSimpleName().toString()); generateSetter(lifecycleAdapterFactory, configField); }// w ww .j a va2s. co m }
From source file:cop.raml.processor.rest.SpringRestImpl.java
@Override public boolean isBodyRequired(@NotNull VariableElement var) { RequestBody annotation = var.getAnnotation(RequestBody.class); return annotation != null && annotation.required(); }
From source file:cop.raml.processor.rest.SpringRestImpl.java
@Override public boolean isUriParamRequired(@NotNull VariableElement var) { PathVariable annotation = var.getAnnotation(PathVariable.class); return annotation != null && annotation.required(); }
From source file:cop.raml.processor.rest.SpringRestImpl.java
@Override public boolean isQueryParamRequired(@NotNull VariableElement var) { RequestParam annotation = var.getAnnotation(RequestParam.class); return annotation != null && annotation.required(); }
From source file:org.mule.devkit.module.generation.LifecycleAdapterFactoryGenerator.java
private void generateGetInstanceMethod(Element element, DefinedClass lifecycleAdapterFactory, DefinedClass poolObjectClass) {/* w w w . j av a 2s . c o m*/ Method getInstance = lifecycleAdapterFactory.method(Modifier.PUBLIC, ref(Object.class), "getInstance"); getInstance.param(ref(MuleContext.class), "muleContext"); Variable object = getInstance.body().decl(poolObjectClass, "object", ExpressionFactory._new(poolObjectClass)); java.util.List<VariableElement> variables = ElementFilter.fieldsIn(element.getEnclosedElements()); for (VariableElement variable : variables) { Configurable configurable = variable.getAnnotation(Configurable.class); if (configurable == null) continue; getInstance.body() .add(object.invoke("set" + StringUtils.capitalize(variable.getSimpleName().toString())) .arg(ExpressionFactory._this().ref(variable.getSimpleName().toString()))); } getInstance.body()._return(object); }
From source file:cop.raml.processor.rest.SpringRestImpl.java
@Override public String getQueryParamDefault(@NotNull VariableElement var) { RequestParam annotation = var.getAnnotation(RequestParam.class); return annotation != null && !ValueConstants.DEFAULT_NONE.equals(annotation.defaultValue()) ? annotation.defaultValue()//from w ww . j ava 2 s.co m : null; }