Questions tagged [java-annotations]

211 questions
2
votes
1 answer

Annotating sentence in multiple lines in GATE

I have an issue with Sentence Splitter module in GATE. My text is something like this: Social history. He drank a lot in his young age. He did not attend a school. He was depressed of his condition. While we are sure that the sentences should be…
A. U.
  • 67
  • 5
2
votes
1 answer

Method invocation based on custom annotation in Spring?

I have a custom annotation: @Target(ElementType.METHOD) @Retention(RetentionPolicy.RUNTIME) public @interface Controller { EventType[] events() default EventType.MESSAGE; } And there are methods in class B using them like…
Ram Patra
  • 16,266
  • 13
  • 66
  • 81
2
votes
0 answers

How to pass parameters using @Sql java annotation

Can someone tell me if there is a way I can pass parameters into a sql file when using the @Sql java annotation?…
reutsey
  • 1,743
  • 1
  • 17
  • 36
2
votes
0 answers

Adding custom Spring Security filter on controller method using annotation?

I have written a custom strong authorization server and libraries for integration called PowerAuth 2.0. Currently, the developer who tries to secure the API call with it can use it as such: @Controller @RequestMapping(value = "/session") public…
1
vote
1 answer

Is it possible to make an Annotation "wrapper"?

To prevent an XY Problem I am gonna state my real issue first but my question focuses on my solution for that problem. I am using Quarkus to build a controller which contains this method: @GET @Path("image/{user}") …
SirHawrk
  • 610
  • 1
  • 4
  • 17
1
vote
0 answers

Annotation processor doesn't execute (gradle)

I'm using gradle and I've written an annotation processor in the project itself and used @AutoService on it. annotationProcessor 'com.google.auto.service:auto-service:1.0-rc5' compileOnly 'com.google.auto.service:auto-service:1.0-rc5' is in…
1
vote
2 answers

How can I specify a javax constraint annotation message as an enum

I would like to specify a javax constraint annotation message as an enum. Since the javax constraint message needs to be a String, I tried using enum#name() as follows: import javax.validation.constraints.NotEmpty; public class Test { enum…
Geoff Alexander
  • 419
  • 5
  • 13
1
vote
1 answer

Custom annotation from others annotations in java

I have date in json like: { "date": "04/22/2022 16:01:01" } and the class: public class Foo{ @JsonDeserialize(using = LocalDateTimeDeserializer.class) @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "dd/MM/yyyy HH:mm:ss") …
1
vote
2 answers

How to enable/disable load time weaving based on a config property

I've successfully enabled AspectJ's LoadTimeWeaving in my Spring project by annotating the configuration class with @EnableLoadTimeWeaving and adding an aop.xml. However, I want to make it config-driven such that by default it is off and is only…
1
vote
2 answers

Can you get subclass Annotation in parent?

This is wired, but can you do this? I want use no-argument constructor ( so develop depend on my framework don't need to extend constructor), but I want use final in field. So : Annotation.java public @interface Annotation { String…
Alceatraz
  • 432
  • 1
  • 3
  • 13
1
vote
1 answer

Jape Rule to annotate sentence and show the numbers in the sentence as feature

I need to write a jape rule to annotate sentence and display the numbers in the sentence as features and tried the following rule Imports: {import static gate.Utils.*; import java.util.regex.Matcher; import java.util.regex.Pattern;…
1
vote
0 answers

How to run a function inside the constructor generated by @AllArgsConstructor?

I have an initializer method inside the parameterized constructor of a class. Right now this is how the class looks like public class Example{ private OtherClass1 otherClass1; private OtherClass2 otherClass2; private OtherClass3…
DashwoodIce9
  • 183
  • 7
1
vote
0 answers

Warn the developer while changing the param name

I am having a requirement where I need to fetch a param the value and validate before a method is invoked. I use MethodInterceptor (org.aopalliance.intercept.MethodInvocation) for this. My method has three String parameters. I need to validate only…
Renjith
  • 1,122
  • 1
  • 19
  • 45
1
vote
0 answers

How to add blank namespace in java using javax.xml.bind.annotation

I'm new to SOAP service, this is my output and java class detail. How to add the blank xmlns in sub level class? Out-Put Request:
Nabeel Ahmed
  • 258
  • 1
  • 7
  • 23
1
vote
1 answer

Accessing the method that an annotation instance is attached to for cross-parameter validation

I have an instanceof an Java annotation which has a target of METHOD: is it possible to get the Method object that it's attached to? I'm trying to do cross-parameter validation, where the validator will apply logic to the combination of parameters…
brianmearns
  • 9,581
  • 10
  • 52
  • 79