Questions tagged [annotations]

1

votes
1

answer
873

Views

Visual Studio Code - Java - Lombok - The method is undefined for the type

I downloaded the following project and imported it into Visual Studio Code: https://github.com/oktadeveloper/okta-spring-boot-2-angular-5-example I have a problem on the following class, when invoking: car.getName(). https://github.com/oktadeveloper/okta-spring-boot-2-angular-5-example/blob/d5c95916...
davidesp
1

votes
2

answer
74

Views

Get all values of a generated Annotation in an Annotation Processor

I have a VariableElement field that is annotated with a generated Annotation (which is why I can't use field.getAnnotation(annotationClass)). I need to get all parameters passed to this annotation. Note that by 'a generated Annotation' I mean that literally the Annotation class itself (not the annot...
Namnodorel
0

votes
0

answer
8

Views

How to add Java annotations to jni swig API

We are using SWIG to create the JNI API between C++ API to Java in Android. So for example lets say that our C++ class is: class TestAnnotation { public: void setMessage(char * message); char * getMessage(); private: char* message = nullptr; }; SWIG produces this auto generated Java class: public c...
1

votes
1

answer
1.5k

Views

Accessing Annotation-value in advice

In my application I have methods annotated like this: @SomeAnnotation(key1='value1', key2 ='value2') public void myMethod() I have defined the following apsect to perform some action on executing of those methods: @Aspect public class MyAspect() { @Around('@annotation(my.package.SomeAnnotation)') pu...
martin
1

votes
3

answer
2.9k

Views

Can we pass value to annotations at runtime?

We need to create an annotation in java called DateFormat. It will take string dateformat eg. class User { @Dateformat('MMM/dd/yyyy') private Date birthDate; } Here the date format is statically passed as an argument to the annotation. Is there any way we can pass this date format at run time may...
ashishjmeshram
0

votes
1

answer
890

Views

Can I create a constant expression for use in attribute parameter?

As anyone answering this already knows, parameters of attributes require constant expressions. Optional parameters (for anything, not just attributes) also require constant expressions for their default values. The (albeit minor) inconvenience I'm having is with RegularExpressionAttribute's pattern...
Lopsided
1

votes
1

answer
503

Views

Mapbox find annotation on the map after long press gesture

I'm new on iOS development and mapbox, so sorry if question sounds to stupid but I can't find it anywhere answer to it. I have a map and annotations on it. I want to show some other info when user touches and hold on the annotation (long press gesture). I got long press gesture to work, but have fo...
mirazasx
1

votes
0

answer
9

Views

How to get the list of all @Test annotation methods from test source package

I'm working on a project where in all the test classes in a package will populate in UI where in I can select any of the class and run. Now I want to extend it to test methods run. For this I need to retrieve all test methods in a test class.I found following class which will give me test classes...
Tanusha Raha
1

votes
1

answer
91

Views

get an int value with @Value

I have application.properties file and I successfully get String values from it with @Value. I am having problems getting an int from it. jedisHostName=127.0.0.1 redisPort=6379 In my config class I have @Value('${jedisHostName}') private String hostName; and it works fine, but when I try to @Valu...
Georgi Michev
1

votes
1

answer
648

Views

asp.net core select validation with data annotation not working

I have spent a remarkable amount of time to find out but I couldn't. When I post my model without selecting any option - in fact selecting 0 - Select - option, the Required validation is not working. I also tried removing the programatically added default option from service code to the view code,...
ibubi
1

votes
1

answer
42

Views

Example of meaningful container elements

What's the usage of: https://docs.oracle.com/javase/7/docs/api/javax/xml/bind/annotation/XmlElementWrapper.html so that a 'collection of collections' can be created programatically in a standards acceptable fashion? IBM pdf with sample Example: The XML Institute Public Library IBM The XML Bible, 2nd...
Thufir
1

votes
2

answer
43

Views

Eclipse IDE dead code warning with two conditions — how to suppress it?

In the code example below, the code block within the if statement is marked as dead code by Eclipse. This is expected because the code is indeed unreachable, however these final properties are intended to serve as a configuration in my actual codebase and may be edited. I can't get suppresswarnings...
Skere
1

votes
0

answer
278

Views

How to remove annotations of a variable in a child class

Let us say that we have a class from API which has some fields, of which some are made mandatory using @NotNull annotation, like below: class SomeAPIClass { private String field1; private String field2; @NotNull public String getField1() { return field1; } public String getField2() { return field2;...
Rupesh
1

votes
2

answer
1.2k

Views

Spring/tomcat Cannot load driver class: com.mysql.jdbc.driver

Lately I have been trying to learn spring boot. I have the following relevant files: an @Configuration class: I use this to generate the entitymanagerfactory an @Entity class: I use this to map to a mysql table instance an @Repository crudrepository interface: this is built in to spring an @Control...
Connor Butch
1

votes
0

answer
76

Views

iText duplicates /Popup annotations when copying pages

When using the following code to copy annotated pages, iText 7.1.0 duplicates the /Popup annotation, the only difference between the 'original' and the duplicate being that one has a /Parent entry and the other doesn't. Unfortunately, the one without the missing /Parent is registered in the /Annots...
Thomas W
1

votes
0

answer
22

Views

Is it possible to add Android Thread Annotations to existing library methods?

I have not found any source which indicates that Android Annotations, like @UiThread, @WorkerThread, can be applied to library codes, for example, ActiveAndroid. I want to enforce that all ActiveAndroid related code to be called in worker thread, but ActiveAndroid is library code, is there a way to...
foresightyj
1

votes
0

answer
56

Views

Data Annotation and EF6

I working on wpf application with syncfusion datagrid (SfDataGrid). The grid uses a data-annotation for autogenerated columns. The model is prepared by EF6. I'm trying to set a column header. This code works (header showing): public partial class ViewShortConsumer { [Display(Name = 'Heade...
Gennady Vorobev
1

votes
0

answer
84

Views

Validated by Class(Constraint class) for Custom Annotation not getting invoked

I have recently started working on custom Annotations. I created a sample spring boot project where it works fine, but When I try to integrate with my project code, the validation class is not getting invoked. ValidateField.java import java.lang.annotation.Documented; import java.lang.annotation.Ele...
Tushar Banne
1

votes
0

answer
135

Views

Class that implements trait with annotated field loses annotation on trait field if annotation contains closure field

#!/usr/bin/env groovy import java.lang.annotation.Retention import java.lang.annotation.RetentionPolicy @Retention(RetentionPolicy.RUNTIME) @interface AnnotationWithClosure { Class closure() default { true } } trait TraitWithAnnotatedField { @AnnotationWithClosure(closure = {}) String foo @Annotatio...
Iaroslav Churinov
1

votes
2

answer
37

Views

@ORM\OneToMany Is retrieving the virtual deleted entries

I have a relation in Doctrine2 @ORM\OneToMany, suposing that i have table school and student, in the entity school i have the @ORM\OneToMany column students, and i also have a virtual deletion column deleted_at, so every student that has the deleted_at different of null is a deleted student that is...
Albert Abdonor
1

votes
0

answer
50

Views

IMarker associated with block of text not being removed

I created a custom marker and annotation in my plugin.xml using org.eclipse.core.resources.markers, org.eclipse.ui.editors.annotationTypes, and org.eclipse.ui.editors.markerAnnotationSpecification. In the code I create the annotation and marker with SimpleMarkerAnnotation annotation = new SimpleMar...
oh_hi_there
1

votes
1

answer
473

Views

Spring AOP Pointcut for methods invoked on field with annotation

I'm writing an aspect for making that possible for dependencies from external libraries to return values that are correctly formatted for my application. With this in mind, I've created an annotation with name @SafeReturns. I wire this class from the external library with the help of spring and in...
dvelopp
1

votes
0

answer
241

Views

Can I make IntelliJ @NonNull/Nullable annotations act like Eclipse

Summary: Is there any way to configure IntelliJ to not add errors to existing un-annotated code but NEVER allow a null to be passed into a @NonNull parameter? Details: Eclipse actually has 3 'nullable' states, @NonNull, @Nullable and Unannotated. IntelliJ appears to have 2 types of nullable, you tr...
Bill K
1

votes
0

answer
198

Views

@ExposeResourceFor multiple resources

I have a controller for which I want to provide hateoas links. The problem is that I have multiple return types in this controller: User and UserDto. My annotation tells that I expose only User, but I also want UserDto. @RestController @ExposesResourceFor(User.class) public class UsersController { @...
WhiteShadow
1

votes
0

answer
173

Views

Extract nested fields in MyBatis annotation

My program is using a Metadata class to describe attributes and fields of different objects: class Metadata { private String objectType; private String table; private String idAttribute; private List attributes; } class Attribute { private String name; private List fields; } class Field { private St...
gorodkovskaya
1

votes
1

answer
257

Views

Feign Client with annotation

I am trying to use feign client with annotation @FeignClient. And i want to invoke feignClient method manually. It works fine when I build feignclient manually with Feign.Builder. But I am a bit lost in using @FeignClient annotation. Thanks, Khush
adroit
1

votes
1

answer
65

Views

Mapping a response to a class in Java

I am developing new feature. I want to get the countries that allowed to retrieve data for a specific endpoint. the request returns this response { 'response': { 'mobile_web': { 'countries': { 'at': { 'start_date': '2014-12', 'end_date': '2017-12', 'fresh_data': '2018-01-23' }, 'br': { 'start_date':...
U. Sultan
1

votes
0

answer
219

Views

Entity Framework 6 filtered index

I'm developing an application using Entity Framework 6 and I want to use filtered indexes (index with where clause). In Entity Framework there is an Index annotation which makes it possible to define an index on a property (column). I define something like public class SqlDefaultValueAttribute : Att...
hamed
1

votes
0

answer
1.3k

Views

Unable to load JDK7 annotation types

In my spring-boot application I've used some model classes and further I need to use the same classes in my android application. So I just export the model class to jar file and put into libs folder in android. I've used some mongo-data annotations(@Document, @Field, etc) in my model class, here my...
Narendhran
1

votes
1

answer
89

Views

PDFTron. Calculating actual annotations size

I am using PDFTron to scan document and extract annotations information in some custom format. And I have problem with Ellipse and Square annotations. For mentioned custom format, I need width and height of square (which can be rectangle). All annotations can be rotated. For rotated rectangle I am...
Stalso
1

votes
1

answer
177

Views

Running tests with specific Adaptavist label

I have gotten a request from a tester to be able to run our selenium tests that hold specific labels on Adaptavist, and I am wondering how to achieve this in the best way. I have tried using the Kanoah API to get all testcases with a label and have managed to get all testkeys that way. I am currentl...
Fritjof Höst
1

votes
2

answer
197

Views

MapKit Direction to Selected annotation

Trying to get direction to selected annotation on the map from the current location of the User but not sure how to catch selected annotation(when user selecting one of them) and show direction.Checked different topics on the Stack but there is not a lot of fresh information about how catch selected...
Ula
1

votes
0

answer
98

Views

Hibernate Converter + retrieve attributename inside Converter

We are trying to use hibernate Converter to encrypt / decrypt data stored via hibernate for few columns @Convert(attributeName='myattr',converter=DataEncryptionConverter.class) private String actualValue; The plan is to implement reusable Converter based on data type (String, Date etc). However the...
Raghavan
1

votes
1

answer
78

Views

Doctrine : UniqueEntity on foreign property?

Is it possible to use a UniqueEntity annotation on a foreign object property ? For example I have two class : class A { private $id; private $num; /** * @ORM\ManyToOne(targetEntity='B' ....) */ private $b; ... } class B { private $id; private $sku; ... } I need to prevent users entering a A.num alre...
Bapt
1

votes
2

answer
2.2k

Views

Spring - Set property value using annotations without using properties file

I am just starting out with Spring. Sorry if this sounds like a stupid question. I have a bean class like, for example class Sample { private String message; public void setMessage(String message) { this.message = message; } public String getMessage() { return message; } } and I want to set this pro...
tejas
1

votes
0

answer
88

Views

JPA @OneToOne mapping with separate @Column definition

I have the following JPA entity relationship: @Entity public class Hardware { @Id @Column(name='id') @GeneratedValue(strategy=GenerationType.AUTO) protected Long id; @OneToOne( fetch = FetchType.LAZY, mappedBy = 'parent', cascade = { CascadeType.MERGE } ) protected HardwareStatus status; } @Entity p...
fancyplants
1

votes
0

answer
302

Views

Add custom HandlerMethodArgumentResolver without having to declare mvc dependency

In my project I'm using the @AuthenticationPrincipal annotation on a few methods of a @RestController. The only information I need tough, is the id field of the custom principal. Currently this looks pretty ugly: public void deleteUsers(@RequestParam(name = 'id') List userIds, @AuthenticationPrincip...
Herr Derb
1

votes
0

answer
250

Views

Spring boot validation with Database

I have a requirement which need to do a custom validation with bean . The validated metadata can be received from Oracle DB. so based on the DB metadata I want to make bean properties as optional or required , apply patterns and do a cross field validation. Can anyone suggest best practices for thes...
Java Spider
1

votes
0

answer
327

Views

Spring Boot : Having a custom annotation on spring rest controller class causing error in identifying handler mapping

I am using a custom annotation called @Toggle on top of a rest controller class in spring boot to intercept the handlerType to block rest calls. See below code snippet: @RestController @Toggle(feature='feature.foo') @RequestMapping('/foo') public class FooController { @RequestMapping('') public Map...
Karthick Selvaraj
1

votes
1

answer
38

Views

Xml file handling - xmlstarlet attribute division (for image annotation)

I have an XML file (like the following) Definitiva armas (1) C:\Users\Rob\Desktop\Definitiva\armas (1).jpg Unknown 240 145 3 0 pistol Unspecified 0 0 3 1 128 100 and I want to make the bounding box coordinates from relative to absolute. In other words, I need to update the xmin value by diving its c...
Nikiforos Botis

View additional questions