FAQ Database Discussion Community


Python anotation arrow direction

python,python-2.7,matplotlib,annotations
I am trying to annotate a scatter plot in Python 2.7, with Matplotlib. Here is the plot code: import pandas as pd import numpy as np import matplotlib.pyplot as plt df = pd.DataFrame(np.random.rand(5,3), columns=list('ABC')) df.insert(0,'Annotation_Text',['ABC','DEF','GHI','JKL','mnop']) q = 2 pqr = 1 # Scatter Plot: x = df['A'] y = df.iloc[:,q]...

Representation of inner source-retained annotation

java,annotations,annotation-processing
We have this class: public class MyClass { @Retention(RetentionPolicy.SOURCE) private @interface MyInterface { } @MyInterface public void hello() { } } As you can see, it has an inner, source-only annotation. My question is: should the exported binary (jar) contain the MyClass$MyInterface.class file or not? If we look at the...

Why must a setter be empty, if the property uses annotation attributes?

c#,annotations,setter
i want to use the setter to auto-correct the value and want to use the RequiredAttribute too. But in this case the RequiredAttribute do not work, because the setter is not empty. So, why have the setter to be empty? [Required(AllowEmptyStrings = false, ErrorMessage = "The Name cannot be empty....

Read controllers custom annotations from a custom Command in Symfony 2

php,symfony2,annotations
I have created custom annotations to generate JSON files (for NodeRed if you ask...) and i'm testing them successfully from a dummy method in a dummy controller. I would like to port all that to a custom Sf command whose job would be to read all Controllers annotations in my...

spring data mongodb find by collection

mongodb,spring-mvc,annotations,spring-data-mongodb
I am using spring-data-mongodb. Here is my controller method: Controller: @RequestMapping(value = "/getByCategory",method = RequestMethod.GET, consumes=MediaType.APPLICATION_JSON, produces=MediaType.APPLICATION_JSON) public Iterable<Node> getByCategory(@RequestParam(value="categories") List<String> categories) throws EntityNotFoundException { Iterable<Node> nodes = nodeService.getByCategory(categories); return nodes; } Here I am passing list of string as a request parameter. My service method is: public Iterable<Node>...

Spring MVC xml based config to annotation

java,xml,spring,spring-mvc,annotations
I am new at Spring and trying to xml based config to annotation basic. I read this tutorial amd coded. It works perfect with xml based config. MVC Spring CRUD Tutorial And now I converted all xml based config to annotation but I have a problem. I ried almost everything...

AnnotatorJS - Necessery fields for retrieving previously stored annotations

javascript,annotations
I am using AnnotatorJS library, and I want to retrieve previously stored annotations from database. My JSON looks like : [{"id":null,"text":"content text","tags":["food","summer"],"tagsStr":null,"ranges":[{"start":"/p[1]","end":"/p[1]","startOffset":82,"endOffset":88}],"json":null}] There are some additional properties, and most of original ones are excluded. Could someone experienced with this library tell me what would be a minimal set of attributes...

How to get value of @XmlElement annotation

java,validation,reflection,xsd,annotations
I have made traversal through object graph to pick up all fields and their given annotations and would like to validate domain objects built from the XSDs based on the annotations. However, i got stuck on the @XmlElement as i don't know how to get the value of required attribute....

android json data to spring mvc4

java,android,json,spring-mvc,annotations
I am new to using Spring mvc4 annotation . In all i want to do is using spring mvc as a web service . so i would be thankful if anyone could provide me a solution for it. My android code is as: HttpParams httpParams = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(httpParams, 5000);...

Load different Entities from a single table with a column as discriminator

java,database,spring,hibernate,annotations
I have the following table with 3 types of people, boy, man and woman: CREATE TABLE IF NOT EXISTS person( id int unsigned NOT NULL AUTO_INCREMENT, type VARCHAR(100), name VARCHAR(100), description VARCHAR(2000), PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO person (id, type, name, description) VALUES(1, 'child', 'Omar', '');...

@WebParam on a parameter of interface method - how to get name?

java,reflection,annotations
I try to get the name "best_user" of the annotation @WebParam on a method parameter User user in an interface method. Because it is an interface, the following code does not give me access to the annotation: String methodName = "doSomething"; Class<?> clazz = Class.forName(packageName + "." + "UserService"); Method...

Elegant way of setting headers in Play Framework 2.4.x

playframework,annotations,http-headers,playframework-2.0
Is there a more elegant way to set the Content-Range, X-Content-Range and Content-Length headers in Play Framework 2.4.x? public static Result stream(Long id) { byte[] data = Song.get(id).getData(); RangeWrapper range = new RangeWrapper(request().getHeader("Range"), data.length); Chunks<byte[]> chunks = ByteChunks.whenReady(out -> { out.write(Arrays.copyOfRange(data, range.getFrom(), range.getTo())); out.close(); }); // Is there a way...

Cannot read property 'split' of undefined

angularjs,annotations,typescript,components,angular2
I have the following code running on my local server. <!DOCTYPE html> <html> <head> <link rel="stylesheet" href="style.css"> <script src="https://jspm.io/[email protected]"></script> <script src="https://code.angularjs.org/2.0.0-alpha.19/angular2.dev.js"></script> </head> <body> <my-app></my-app> <script> System.config({ paths: { '*': '*.js', 'angular2/*': 'angular2/*' } }); System.import('main'); </script> </body> </html> The above is the...

Annotations to detect method calls with wrong order of String parameters

java,intellij-idea,annotations,code-inspection
We have a big application which uses a lot of Strings: for serial numbers for product names for order number for customer references ... and many more ... Unfortunately our developers are only human. Sometimes the String values get mixed up when calling methods. For example: // this method public...

Annotating video frames with a label based on state

python,matlab,video,annotations,computer-vision
I have a bunch of videos and depthmaps showing human poses from the Microsoft Kinect. I can get a skeleton of the human in the video but what I want to do is recognize a certain pose from this skeleton data. To do that I need to annotate each frame...

PHP-DI annotation not working

annotations,inject,php-di
I have installed php-di 4.4 in a new custom project using composer.Im runing a xampp localhost with php 5.6.3 but I set netbeans for php 5.4 on this project. Im new to php-di, I did use annotations in my android projects but cant seem to make it work here. The...

How to use testng annotations in java

java,annotations,testng,selendroid
My code public class Test{ @BeforeTest public void create_user throws Exception (){ } @Test public void user_actions throws Exception (){ } @AfterTest public void delete_user throws Exception(){ } } Above is my test class. If i get any error in create_user(), currently its throws Exception and ran out of the...

How do I access parameters specified in a Java Aspect?

java,reflection,annotations,aop
I have an annotation called "@ProgressCheck" that we can put on a controller to check the progress of an application. If the application is already submitted or late, then it throws the user to a page appropriate for that situation. The annotation interface is: @Retention(RetentionPolicy.RUNTIME) public @interface ProgressCheck { }...

How to write an annotation for classes to be outputted to LogCat?

java,annotations
Can I create an annotation that will make the class call Log.e("", "") and have the class in which the method is in's name as the first argument and the method name as the second argument? Something like this: public class UploaderService { @Debuggable void onUploadProductSuccess(int productServerId) { } }...

How to define an annotation for more than one target in Groovy?

groovy,annotations
In Java, to define an annotation for more than one target, the curly braces can be used: @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.TYPE, ElementType.FIELD}) public @interface AnnotExample { String name(); } However, this doesn't work in Groovy: $ groovyc AnnotExample.groovy org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed: AnnotExample.groovy: 8: expecting '}', found ',' @ line 8, column 26....

Annotation Reflection for Method overrided [duplicate]

java,reflection,annotations
This question already has an answer here: How do Java method annotations work in conjunction with method overriding? 4 answers How to I can get the Annotation Object for method that was overriden. /* I created a custom annotation named AclIgnore, and I have the next following piece of...

How to get full return type forwarding in Xtend's Active Annotations?

java,android,annotations,xtend
I'm trying out Xtend's Active Annotations by writing a simple "Logged" annotation for tracing when methods have been called. Basically I want to write this in Xtend: @Logged override onCreate() { sampleFuncCall() } and get something like this in Java: @Override void onCreate() { Log.d("TAG", "onCreate started"); sampleFuncCall(); Log.d("TAG", "onCreate...

Symfony2 Annotation Inheritance

php,symfony2,annotations
In my project, I have a BaseController class which implements several methods used by all of my controllers. Now I wanted to add @QueryParam for that base class. My class looks like this: class DoctrineRESTQueryController extends FOSRestController { /** * @QueryParam(name="start",default=0) * @QueryParam(name="limit",default=null) */ public function getQueryResponseAction (ParamFetcher $paramFetcher) {...

Annotation processing for Dagger with Maven

java,maven,annotations,dagger
I am setuping Maven for project that uses Dagger, but I can't find good guide about annotation processing setup for maven-processor-plugin Here is part of my pom.xml <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> <plugin> <groupId>org.bsc.maven</groupId>...

Is the deployment descriptor obsolete in Java EE?

java,java-ee,annotations
I have seen java web applications written without the deployment descriptor(web.xml) after the introduction of special annotations. Has annotations completely replaced the deployment descriptor in java EE? is using DD considered as obsolete? Can any java EE application be written without the deployment descriptor in new java versions?...

org.hibernate.exception.GenericJDBCException: could not execute statement in hibernate

java,hibernate,annotations
I am trying to use embeddable annotation to store different values in one object to be persisted in one table. I have two classes: userDetails: package org.hibernet.src; @Entity @Table (name="UserDetails") public class userDetails { @Id @GeneratedValue(strategy = GenerationType.AUTO) private int userId; @Temporal(TemporalType.DATE) private Date dob; public Date getDob() { return...

Dynamic annotation/attribute values

c#,validation,annotations,attributes
I run into a problem using data annotations in c#. I am using custom required and range attributes and I want to set an object as the error message. [MyOwnRequired(ErrorCode=GlobalMessages.Message01] public string Description { get; set; } The problem is that I do have a class holding several objects (GlobalMessages.Message01,...

Typo3 - extbase - Missing type information, probably no @param annotation for parameter “$currentPage”

annotations,typo3,extbase,typo3-6.2.x
I get the following error in Typo3 Backend: Missing type information, probably no @param annotation for parameter "$currentPage" in Tx_OptivoBm_Controller_NewsletterController->newAction() The function is set up like that: /** * action new * * @param $currentPage * @param $newNewsletter * @dontvalidate $newNewsletter * @return void */ public function newAction($currentPage) { if...

Difficulty annotating plot when x axis values are dates

r,ggplot2,annotations
Here is my data frame: > s Date Average Treatment SE 1 2014-10-15 4.875 1 1.6304852 2 2014-11-12 6.250 1 0.9955257 3 2014-12-11 0.250 1 0.1636634 4 2015-02-11 1.000 1 0.5000000 5 2015-03-09 0.000 1 0.0000000 6 2014-10-15 22.750 2 3.4369318 7 2014-11-12 10.625 2 2.1207942 8 2014-12-11 7.500 2...

How can I replace GWT.create with an Annotation Processor?

java,gwt,annotations,annotation-processing
I want to create an Annotation Processor which replaces the call to GWT.create. With an annotation processor, you'd have to generate both classes and then dynamically (at runtime) select among them, depending on the context (you could generate a factory to help doing that, but you'd still have to somehow...

Why does Java 8 apply annotations differently to derived classes?

java,annotations,java-8
If I have the following two classes: // Base.java public abstract class Base<T> { abstract void method(T t); } and // Derived.java public class Derived extends Base<Number> { @Deprecated void method(Number n) {} } I then compile them with javac Base.java Derived.java and then use javap -v Derived. If I...

Annotator dependencies: UIMA Type Capabilities?

java,annotations,nlp,uima,dkpro-core
In my UIMA application, I have some annotators that must run after a certain annotator has run. At first, I thought about aggregating these annotators together, but I have other annotators that are also dependent on this (and other) annotator, which makes aggregating hard and/or unpractical. I read about Type...

Abstract class with Custom Annotations

java,reflection,annotations
First, I am pretty new to Java reflection, generics and annotations. I would like to develop an abstract class that would allow me to support a various set of POJOs (value objects to be more accurate) by providing generic implementations/methods based on custom annotations from the child class. Abstract Class...

Can't get @override annotation from method

java,annotations
When I get method from class instance, and want to get @override annotation. but method has not any annotation. Is it impossible to get @override annotation? code is below. package com.test; import java.lang.annotation.Annotation; import java.lang.reflect.Method; import javax.annotation.Resource; public class ReflectionTest { public static void main(String[] args) throws Exception { ChildHoge...

Array Constants (Fields) as Annotation Values

java,arrays,annotations,compile-time-constant
While this code happily compiles (with Java 8 / Eclipse Compiler) public @interface specialized { public Class[] value() default { int.class, long.class, float.class, double.class }; } Refactoring it to use a constant instead of an array causes an error: public @interface specialized { public static final Class[] COMMONS = {...

Ambiguous mapping found when I use extends clause

java,spring-mvc,inheritance,annotations
I have a CustomerController and CustomerCardController classes that extend CrudMethods class. I choose so, because these two controller use the same methods (getFileCustomer() is one of these). And I thought that it had been better use the inheritance to save code's rows. CustomerController @Controller public class CustomerController extends CrudMethods {...

Java - Parameter annotations

java,annotations
Having trouble getting the parameter annotations of a method, below is a easy to test demonstration, any directions towards the error would be welcome : // Annotation public @interface At {} // Class public class AnnoTest { public void myTest(@At String myVar1, String myVar2){} } // Test public class App...

How to implement a parameter decorator in TypeScript?

annotations,typescript,decorator
I've been trying to use a parameter decorator @logParameter: class Person { public name: string; public surname: string; constructor(name : string, surname : string) { this.name = name; this.surname = surname; } public saySomethingAsync(something: string, @logParameter cb: (said : string) => void) { cb(this.name + " " + this.surname +...

why spring 4 recommend annotation rather than configuration file? [closed]

java,spring,configuration,annotations
Recently I'm learning the spring framework of java. I am curious that why spring 4 recommend annotation to set up spring rather using configuration file? Some people said that the spring configuration file is too complicated. But I think using annotation is going to the opposite direction of purpose of...

Java: Generate Annotation with default value using Codemodel

java,annotations,sun-codemodel,jcodemodel
I use the Sun CodeModel code generator for my project. During this I came to the point to generate an annotation class. This class would have an array member which takes an empty array as default values. See the following example: public class Container { public @interface MyAnnotation { MyValue[]...

JSR-308 extension of JSR-305?

java,annotations
Eclipse's null analysis now supports JSR-308, i.e. you can now put @Nonull, etc. on generic type parameters. However, the widely-used com.google.code.findbugs:jsr305:3.0.0 package does not have the JSR-308 specific targets. Is there any JSR-308 oriented version of this or a way to extend the JSR-305 null annotations?...

Reading Value of an annotated field

java,web-services,spring-mvc,annotations,java-8
I have a restful web service written in spring. the HTTP request are mapped on to a bean(I call it request object). I have custom annotation on each field in the bean. My reqirement is to : 1. get all annotated field and check atleast value for one is provided....

How can I specify the type of the field that an Annotation should be applied to in Java?

java,android,reflection,annotations
I'm creating a simple annotation, to help me inflating settings inside my Android application. The annotation is this: @Target(ElementType.FIELD) @Retention(RetentionPolicy.RUNTIME) public @interface CoreSettings { String name() default ""; } I want to ensure it will only be used in fields which type extends a custom class named BaseSettings. In the...

Which are the default modifiers for fields and methods in a Java annotation?

java,annotations,access-modifiers
Which are the default modifiers for x and m in public @interface Anno { int m() default x; int x = 10; } ? I suppose that the code above is equivalent to: public @interface Anno { public int m() default x; public static final int x = 10; }...

Technical debt on custom web rule in sonarqube 5.1

web,annotations,sonarqube,sonar-runner,sonarqube-5.0
I am facing issue in technical debt with custom web rules. I have web plugin but no technical debt is assigned to rules. I want code or annotation through which i can assign some constat/issue value to each rule and can calculate debt from that. I used following anotations while...

Regex for a five-digit numerical String

java,regex,annotations
I'm currently trying to design a regex for a five-digit numerical String, which will be used to store the number of a flight. It's important that this number is exactly 5 numerical characters long. So far, I've come up with this, but it seems a bit flabby: @NotNull @Size(min =...

Adding a pin annotation to a map view on a long press in swift

ios,swift,annotations,maps,mkmapview
I'm trying to make an iPhone app which requires users to be able to long press on a place on a map view to drop a pin there. Does anybody know how this is done? The behaviour is observable in apple maps when you long press on the screen. It...

Is it possible for an annotation processor to access types generated in a previous round?

java,annotations,annotation-processing
I have an annotation processor that generates an ID class for each annotated class. I would like classes to be able to refer to the generated ID types of other classes in the same compilation unit. Unfortunately, it seems like the annotation processor always gives the kind of a generated...

Get id column name from POJO, using reflection

java,jpa,reflection,annotations
@Entity @Table(name="MY_TABLE") public class MyTable{ @Id @Column(name="MY_TABLE_ID") @GeneratedValue(strategy = GenerationType.AUTO ,generator="SQ_MY_TABLE") @SequenceGenerator(name="SQ_MY_TABLE", sequenceName="SQ_MY_TABLE") private Long myTableId; How can I, using reflection, get the primary key column name from my POJO, defined with the javax.persistence.Id annotation? I'd have to find the @Id and then get the name property of the @Column...

More than one Pin annotation

ios,xcode,swift,annotations,mapkit
I have annotation that will show on long press (1sec) and I want to create more than one annotation because now I can create only one annotation. So I want to ask you guys how can I do it? Code for annotation setup: in viewDidLoad var longPress = UILongPressGestureRecognizer(target: self,...

Check class hierarchy at compile on an annotation processor

java,annotations,jvm,annotation-processing
I'm writing an annotation processor to perform the following check at compile time: There's an interface E There's an annotation @Apply which is used to annotate methods. Methods annotated with @Apply should be called apply and take only one parameter of a class implementing E I've gotten so far as...

How to automatically format PHP annotations in PHPStorm

php,annotations,phpstorm,swagger-php
I'm working with a large number of files that have PHP block docs with Swagger PHP annotations on them, however they are not indented. Is there anyway to automatically format them with spaces? Turning /** * @SWG\Api( * path="/building/{buildingId}", * @SWG\Operation( * method="GET", * type="Building", * summary="Returns a Building object...

Showing drop pin after relaunch app?

ios,xcode,swift,annotations,save
I have application with map where you can make an annotation by dropping a pin. How can I save the annotation, so you can see it when the application is closed and re-opened? My code's for annotation func addAnnotation(gesture: UIGestureRecognizer) { if gesture.state == UIGestureRecognizerState.Began { var touch = gesture.locationInView(self.Mapa)...

Can't select an annotation with skobbler

swift,dictionary,ios8,annotations
I have created a map with Skobbler SDK an add some annotations but when I touch one annotation, the following method will not launch : func mapView(mapView:SKMapView!, didSelectAnnotation annotation:SKAnnotation!) { println("test") } Annotation creation code : //create the label var label = UILabel(frame: CGRectMake(0, 54, 122, 21)) label.textAlignment = NSTextAlignment.Center...

Spring MVC “Request processing failed” 500 error

java,spring,hibernate,spring-mvc,annotations
I am new at Spring and trying to learn with tutorial. And I have a problem. I converted to xml based config to annotation based config. this is tutorial. And I receive HTTP 500 error. This is full stacktrace. SEVERE: Servlet.service() for servlet [dispatcher] in context with path [] threw...

Get Element where TypeElement is defined in?

java,annotations,annotation-processing
I have the following class: public class Start extends PlacePresenter { @NameToken("startPage") public interface MyProxy extends ProxyPlace { } } In an annotation processor I got the Element annotated with @NameToken which is MyProxy. @Override public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) { for (Element annotatedElement : roundEnv.getElementsAnnotatedWith(NameToken.class)) {...

How to add Coordinates to CLLocationCoordinate2D from Dynamic NSMutableArray?

ios,objective-c,annotations,nsmutablearray,mkmapview
I have a MapView in which I would like to add annotations and a route from defined coordinates that I add from a Textfield and store in an NSMutableArray. Now I'm able to show the route from multiple coordinates but only when I insert them in my code as follow...

Will Java Annotations make the performace slow because of reflection?

java,reflection,annotations,jersey
If we use Java annotations will the reflection apis be called everytime to analyze those annotations? Wont that make the execution slow? By everytime I mean whenever that flow is executed. Example Case: IN Jersey we use the annotations @Get which is used everytime there is a get request on...

Is there a way to use @Query to return a MongoDB $sum result?

spring,mongodb,annotations,repository,aggregation
I'm pretty new to both MongoDB and StackOverflow (as a questioner). I've seen a great response for how to return a MongoDB "count" projection from a Spring repository using the @Query annotation (Count in Spring data mongodb repository). Basically the count example looks like: @Query(value = "{'productDetails.productType': {$regex: ?0, $options:...

Changing the position of a CorePlot annotation after zooming(iOS)

ios,objective-c,cocoa-touch,annotations,core-plot
I am using a CorePlot ScatterPlot to display data readings from an external bluetooth sensor. Ive gone through the following tutorial: http://www.raywenderlich.com/13271/how-to-draw-graphs-with-core-plot-part-2 and Ive got everything working the way that I would like with one exception. When the user taps on one of the data points, an annotation is placed...

How can I ask a JMS server to resend the message when an exception occurs in a JMS listener defined with the @JmsListener annotation?

annotations,jms,listener,spring-boot
I have been writing a JMS listener in a Springboot application. I used two ways: 1) Defines a a bean which is SimpleMessageListenerContainer like this: @Bean SimpleMessageListenerContainer getMyMessageListenerContainer(ConnectionFactory connectionFactory) { MessageListenerAdapter messageListener = new MessageListenerAdapter(myService); messageListener.setDefaultListenerMethod("myMethodListener"); SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(); container.setMessageListener(messageListener);...

Simple Route to an action in another controller

c#,.net,asp.net-mvc,routes,annotations
i have an MVC .Net C# project. have Plan Action under Home Controller. but i dont want to access this page as http://....../Home/Plans but i want to access it as http://....../Plans but i dont want to create Plans Controller. so i dont want to do a redirectToAction. i am trying...

What is the correct CascadeType in @ManyToMany Hibernate annotation?

java,hibernate,annotations,many-to-many,cascade
I am trying to model a transient operations solution schema in Hibernate and I am unsure how to get the object graph and behavior I want from the model. The table structure uses a correlation table (many-to-many) to create lists of users for the operation: Operation OperationUsers Users op_id op_id...

iOS: (Swift) How to show distance from current location and exist annotation on annotation subtitle

ios,swift,annotations,mapkit,alamofire
I am currently working on map application base on iOS using Swift language. I would like an suggestion because after I plot all the pins on map view (which I receive data from my server using JSON frameworks call Alamofire) I would like the subtitle of all annotations on map...

How to get @interface parameter in jersey WriterInterceptor Implementation

java,annotations,jersey,jax-rs,interceptor
I have an interface, for example @NameBinding @Retention(RetentionPolicy.RUNTIME) public @interface AutoLogged { boolean query() default false; } How can I get query parameter in interceptor implementation? @Provider @AutoLogged public class AutoLoggedInterceptor implements WriterInterceptor { @Context private ResourceInfo resourceInfo; @Override public void aroundWriteTo(final WriterInterceptorContext context) throws IOException, WebApplicationException { try {...

Pros and cons of using type annotations in Swift

ios,swift,annotations
I was wondering the difference of using and not using type annotations(var a: Int = 1 vs var a = 1) in Swift, so I read Apple's The Swift Programming Language. However, it only says: You can provide a type annotation when you declare a constant or variable, to be...

Missing @Override in Java Libraries

java,inheritance,annotations,jvm
It is considered to be a good practice to use @Override annotation on methods which are being overriden in subclass. But why is same not applied to the classes that come with Java Library. For e.g. String Class. It overrides methods of Object class but does not use @Override annotation...

Can I use annotation to call method after the annotated one?

java,annotations
I am wondering if I can use custom annotation to call some method right after annotated one. For example I have a class that holds some settings that can also notify objects that something has changed (for example user changed something in settings panel). Not all listeners are interested in...

Show deprecated warnings for methods of same class

java,eclipse,annotations,deprecated
Using eclipse, I want to see a warning as soon as any of my used methods is marked as @Deprecated. Method calls are correctly crossed out if so, but eclipse does not give out a warning if the method origins from the same class. See the screenshot below. For better...

JPA. @Column(updatable=false) on @ManyToOne related field

hibernate,jpa,annotations,many-to-one
In my auditable entities I have field creationUser which I would like to not update in db on merge operation. Here is my entity code: @Column(updatable=false) @ManyToOne(cascade = CascadeType.MERGE) public User creationUser; But it gives me an error: Unexpected exception PersistenceException: [PersistenceUnit: defaultPersistenceUnit] Unable to build EntityManagerFactory Caused by: org.hibernate.AnnotationException:...

Why I must have a default constructor in a Spring configuration class annoted by the @Constructor annotation?

java,spring,spring-mvc,annotations,applicationcontext
I am studying for Spring Core certification and, on the provided study stuff, I have this question but I can't give an answer to it. Why must you have to have a default constructor in your @Configuration annotated class? I don't declare any constructor into my configuration classes annoted by...

In a JUnit test is there a rule to set the subject of the test

java,junit,annotations
I've been writing a lot of JUnit tests lately and see this same boilerplate pattern. public class MathOpTest { private MathOp a; @Before public void setUp(){ a = new MathOp(); } ... } Is there an annotation to set this up for me as I always need to write a...

Update custom annotation pin image to standard annotation pin in swift

ios,swift,annotations,mapkit,coordinates
I want to update map view every 60 seconds & make an annotation with custom pin/image but want to show standard pin [red color - See Figure 6-1] icon to the previously drawn annotation. I tried like below code but that does not working properly. With another custom image it...

Java custom annotation to find methods

java,annotations
I want to create annotation (for which I can set some kind of id), which I can put on variable, and write method which return getter or setter method of this variable by annotations setted id; As example I made something like that but only for method, so I need...

Is there a way to enclose multiple event declarations on a single [] block?

events,f#,annotations
It is a little tedious to write: let e1 = Event<_>() let e... = Event<_>() let en = Event<_>() [<CLIEvent>] member this.E1 = e1.Publish [<CLIEvent>] member this.E... = e....Publish [<CLIEvent>] member this.En = en.Publish In the code, I show how I need to write n [<CLIEvent>], 1 for each event....

@PathVariable and @RequestParam not working together

spring,spring-mvc,annotations,spring-annotations,path-variables
I have below code in my controller: @RequestMapping(value = "/child/{nodeId}/{relType}",method = RequestMethod.GET, produces=MediaType.APPLICATION_JSON) public Iterable<Node> getConnectedNodes(@RequestParam("page")int page, @RequestParam("size")int size, @PathVariable("nodeId") String nodeId, @PathVariable("relType") String relType) { return nodeService.getConnectedNodes(nodeId, relType,page,size); } And this is the API url i am hitting...

(Java) if statement optimization

java,rest,annotations,jax-rs,sonarqube
Need to optimize this code : import java.lang.annotation.Annotation; import java.lang.reflect.Method; import javax.ws.rs.CookieParam; import javax.ws.rs.FormParam; import javax.ws.rs.HeaderParam; import javax.ws.rs.MatrixParam; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.QueryParam; ... private String valueParam(Annotation a) { String value = ""; if (a.annotationType() == QueryParam.class) { value = ((QueryParam) a).value(); } else if (a.annotationType() == PathParam.class) {...

Groovy multiple Delegate annotation/Wrapper for list

list,groovy,delegates,annotations
I'm struggling how to use the @Delegate annotation in Groovy. What I'm trying to achieve is the following. I have two types of items (itemA & itemB). ItemB basically consists of a list of itemA's, so I used the @Delegate annotation. Furthermore, multiple itemA's are stored in a collection (collectionA),...

Animated annotation on WKInterfaceMap Watchkit

ios,animation,annotations,apple-watch,wkinterfacegroup
Is there anyway to have an animated annotation for WKInterfaceMap of Watchkit? I have 35 images to form the animation. Currently I am using a NSTimer which calls -(void)addAnnotation:(CLLocationCoordinate2D)location withImageNamed:(NSString *)name centerOffset:(CGPoint)offset method with a different image names but the result is not efficient and the animation is not smooth...

@Path annotation: abstract resource in dropwizard

java,groovy,annotations,jetty,dropwizard
I had an idea to build abstract resource class for my application: abstract class MyAbstractResource<A> { MyAbstractDao dao; public MyAbstractResource(MyAbstractDao dao) { this.dao = dao; } @Path("/") @POST @Produces(MediaType.APPLICATION_JSON) @Timed public A create(A account) { return dao.create(account); } @Path("/{id}") @PUT @Produces(MediaType.APPLICATION_JSON) @Timed public A update(A account) { return dao.change(account); }...

Swift - Directions to Selected Annotation from Current Location in Maps

swift,annotations,mapkit,mklocalsearch
My app currently has a local search which adds annotations for the search results. I want to set it up where when you select the annotation and click the call out button, it will open in the Maps application with directions to the annotation from the current device location. I'm...

Annotations in hibernate are of hibernate or java persistance API?

java,hibernate,jpa,annotations
I have come across articles explaining about hibernate annotations like (@Entity,@Id). Are these annotations implemented in hibernate or are they from Java persistence API? What if we decide to use some other ORM tool. Then do we have to change all the annotations to suit the other ORM tool? or...

What should I annotate when I unit test the GPS function with Robolectric?

unit-testing,annotations,robolectric
I am referring the following site http://googletesting.blogspot.ca/2010/12/test-sizes.html . There it was mentioned that we should annotate @LargeTest if our test method is accessing the network feature. I am using Roboloectric for unit testing. And my method uses the shadowLocationManager to simulate the GPS location. I am not sure what should...

Tell Proguard to keep annotation on methods

java,android,annotations,proguard
I'm using my own annotation: @Retention(RetentionPolicy.RUNTIME) @Target({ElementType.METHOD, ElementType.TYPE}) public @interface Loggable { } and obfuscate using Proguard. I use the -keepattributes *Annotation* in the Proguard configuration to keep the annotations. At runtime, when I retrieve the annotation from an annotated class using someClass.getAnnotation(Loggable.class) everything works - I retrieve a non-null...

getting 404 when consumiing spring controller service

java,html,spring,annotations,spring-3
I have created a spring application (Spring version 3.2.8). The application is working fine but the issue which I am facing is that when I try to consume the controller service through url I am getting 404 error The url which I try to consume through browser url is given...

Read annotation of generic class Java

java,generics,annotations
I had an idea to use a Dao class (Dao.java): class Dao <Model extends AbstractModel> { public String getUrl() { return Model.class.getAnnotation(MyPath.class).url(); } } and a model like this (Account.java): @MyPath(url = "blabla") class Account extends AbstractModel { ... } but the problem is that in that case if i...

How should I write my own custom Annotation in Java

java,annotations
Let say I want to check condition[let say boundary values] on some of the method arguments.Instead of writing "if" condition to check [boundary condition] on every method, I want to annotate argument only. Let me know the Steps to understand it. Working code will be awesome.

Get Observer pattern on EJBs working on my web app

java,java-ee,annotations,ejb,observer-pattern
I am trying to get the EJB Observer pattern to work and it seems very straight forward from examples like this: http://www.devchronicles.com/2011/11/javaee-revisits-design-patterns_28.html however when I implement the method: public void doLogging(@Observes String message){ System.out.println("Observed:"+message); } the @Observer annotation import does not get inserted. Also if I do it manually as:...

Filter array based on coordinate from mapview frame in objective C

ios,objective-c,xcode,annotations,mkmapview
I have hundred's of map annotation. Annotation are from array of dictionary with lat and long val same data shown in table view. Table view and map view are same view based on screenheight/2. What I need for example in my array have 100 lat and long value table view...

Symfony2 / Doctrine2 : how to access an entity annotation mapping?

symfony2,doctrine2,annotations,mapping,accessor
In my Symfony2/doctrine2 application, I have two entities, Media and Recipe. They can be linked by a oneToMany or a ManyToMany association. In the case of a oneToMany relationship, I am using the following code to retrieve the Recipe linked to an instance of Media : $accessor = PropertyAccess::createPropertyAccessor(); $reflect...

Array of annotations as parameter to an annotation, in Scala

spring,scala,annotations
There are plenty of questions about passing an array as a parameter to an annotation, this is not a dupe of those. I would like to use a Java-land annotation that takes an array of annotations as a parameter, e.g. @ManagedOperation @ManagedOperationParameters({ @ManagedOperationParameter(name="start"), @ManagedOperationParameter(name="end") }) def stuff(start: String, end: String):...

spring-cassandra UDT data insert

java,annotations,cassandra,datastax-java-driver,spring-data-cassandra
Can someone help me to find out how to insert Cassandra UDT data using Spring POJO class? I created one POJO class to map Cassandra's Table and Created one another class for Cassandra UDT, but when i inserted main POJO class that map Cassandra's table than it's not recognized another...

Python - Add annotation in subplot imshow

python,matplotlib,annotations,imshow
I would like to add some annotations on a figure with multiple subplots...On the figure below i would like to write something below the 2 right figures and at the left top. How can i do that? I try with : ax3.text(0.1, 0.5, '$\sigma =$' resV.mean(), size=12, ha='center', va='center') But...

FuntionalInterface Annotation Type in Java

java,interface,annotations
I was reading about java annotation and a new doubt appears. In the documentation explain the FunctionalInterface Annotation Type: An interface with one abstract method declaration is known as a functional interface.The compiler verifies all interfaces annotated with a @FunctionalInterface that the interfaces really contain one and only one abstract...

Symfony2 AnnotationException You have to enable OPCache or ZendOptimizer

symfony2,doctrine2,annotations,doctrine,opcache
I have application based on the Symfony2 framework. I have moved to the production environment, website was running fine (I was trying to adjust caching - on my hosting is xcache). But suddenly I has this error: Fatal error: Uncaught exception 'Doctrine\Common\Annotations\AnnotationException' with message 'You have to enable opcache.save_comments=1 or...

Get TypeElement from Generic TypeParameterElement for Java Annotation Processor?

java,annotations,annotation-processing
Using Java Annotation Processors I have the following type: @NameToken(value={"startPage"}) public interface MyProxy extends Proxy<StartPagePresenter> { } and: public interface Proxy<T> { } I have the TypeElement of Proxyas: TypeElement pProxyTypeElement = // ... Now I want to get the TypeElement of the Type Parameter <StartPagePresenter>. I tried: List<? extends...

Annotations on fields not processed between different deployments in JBoss

java-ee,jboss,annotations,jboss6.x,jboss-modules
We have an issue where we have a superclass with an annotation (@Resource) and subclasses that extend that superclass are are stateless beans. Very similar to this, if the superclass and subclass are in the same module then the resource is injected successfully. If they are in separate modules then...

How to inject a Map using the @Value Spring Annotation?

java,spring,dependency-injection,annotations,spring-annotations
How can i inject values into a Map from the properties file using the @Value annotation in Spring ? My Spring Java class is and i tried using the $ but, got the following error message Could not autowire field: private java.util.Map Test.standard; nested exception is java.lang.IllegalArgumentException: Could not resolve...

Specify user handlers for JAX-RS when using annotation scanning

rest,annotations,websphere-liberty,apache-wink
How to specify user handlers for JAX-RS when using annotation scanning? I am following this link and have created my custom handlers. I have annotated my Application subclass as: @ApplicationPath("rest") public class RestfulResourceLoader extends Application { } so that I don't have to entry in web.xml file. What I am...

How to map multiple One-to-Many association in Hibernate

java,hibernate,annotations,one-to-many
I have these 3 tables in my database CREATE TABLE IF NOT EXISTS `User`( `id` INT NOT NULL AUTO_INCREMENT, `name` VARCHAR(255) NOT NULL DEFAULT '', PRIMARY KEY (`id`) ) CREATE TABLE IF NOT EXISTS `Project` ( `id` INT NOT NULL AUTO_INCREMENT, `manager` INT NOT NULL, `name` VARCHAR(255) NOT NULL DEFAULT...