ggplot2 – annotate outside of plot

This is now straightforward with ggplot2 3.0.0, since now clipping can be disabled in plots by using the clip = ‘off’ argument in coordinate functions such as coord_cartesian(clip = ‘off’) or coord_fixed(clip = ‘off’). Here’s an example below. # Generate data df <- data.frame(y=c(“cat1″,”cat2″,”cat3”), x=c(12,10,14), n=c(5,15,20)) # Create the plot ggplot(df,aes(x=x,y=y,label=n)) + geom_point()+ geom_text(x = … Read more

Scanning Java annotations at runtime

Use org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider API A component provider that scans the classpath from a base package. It then applies exclude and include filters to the resulting classes to find candidates. ClassPathScanningCandidateComponentProvider scanner = new ClassPathScanningCandidateComponentProvider(<DO_YOU_WANT_TO_USE_DEFALT_FILTER>); scanner.addIncludeFilter(new AnnotationTypeFilter(<TYPE_YOUR_ANNOTATION_HERE>.class)); for (BeanDefinition bd : scanner.findCandidateComponents(<TYPE_YOUR_BASE_PACKAGE_HERE>)) System.out.println(bd.getBeanClassName());

What’s the difference between @Component, @Repository & @Service annotations in Spring?

From Spring Documentation: The @Repository annotation is a marker for any class that fulfils the role or stereotype of a repository (also known as Data Access Object or DAO). Among the uses of this marker is the automatic translation of exceptions, as described in Exception Translation. Spring provides further stereotype annotations: @Component, @Service, and @Controller. … Read more

Only one annotation is showing

The class indeed has only one annotation. The other two belong to the class methods. To get to them you’d do something like: Method getValue = Tree.class.getMethod(“getValue”); //get the method getValue.getAnnotations(); //get annotations, only ElementField in this case The same for every other method.