Commit 69c2621a authored by Stephane Nicoll's avatar Stephane Nicoll

Polish "Add support for @Value annotation"

See gh-26337
parent 14d86034
...@@ -65,7 +65,7 @@ The processor picks up both classes and methods that are annotated with `@Config ...@@ -65,7 +65,7 @@ The processor picks up both classes and methods that are annotated with `@Config
If the class is also annotated with `@ConstructorBinding`, a single constructor is expected and one property is created per constructor parameter. If the class is also annotated with `@ConstructorBinding`, a single constructor is expected and one property is created per constructor parameter.
Otherwise, properties are discovered through the presence of standard getters and setters with special handling for collection and map types (that is detected even if only a getter is present). Otherwise, properties are discovered through the presence of standard getters and setters with special handling for collection and map types (that is detected even if only a getter is present).
The annotation processor also supports the use of the `@Data`, `@Getter`, and `@Setter` lombok annotations. The annotation processor also supports the use of the `@Data`, `@Value`, `@Getter`, and `@Setter` lombok annotations.
Consider the following example: Consider the following example:
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2021 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -102,11 +102,8 @@ class LombokPropertyDescriptor extends PropertyDescriptor<VariableElement> { ...@@ -102,11 +102,8 @@ class LombokPropertyDescriptor extends PropertyDescriptor<VariableElement> {
if (lombokMethodAnnotationOnElement != null) { if (lombokMethodAnnotationOnElement != null) {
return isAccessLevelPublic(env, lombokMethodAnnotationOnElement); return isAccessLevelPublic(env, lombokMethodAnnotationOnElement);
} }
return (hasAnnotation(env, LOMBOK_DATA_ANNOTATION) || hasAnnotation(env, LOMBOK_VALUE_ANNOTATION)); return (env.hasAnnotation(getOwnerElement(), LOMBOK_DATA_ANNOTATION)
} || env.hasAnnotation(getOwnerElement(), LOMBOK_VALUE_ANNOTATION));
private boolean hasAnnotation(MetadataGenerationEnvironment env, String lombokAnnotation) {
return (env.getAnnotation(getOwnerElement(), lombokAnnotation) != null);
} }
private boolean isAccessLevelPublic(MetadataGenerationEnvironment env, AnnotationMirror lombokAnnotation) { private boolean isAccessLevelPublic(MetadataGenerationEnvironment env, AnnotationMirror lombokAnnotation) {
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2021 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2021 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2020 the original author or authors. * Copyright 2012-2021 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
/* /*
* Copyright 2012-2019 the original author or authors. * Copyright 2012-2021 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
......
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