annotations

Hiding map annotations without deleting them.

Using a MKMapView I have a pile of annoatations loaded onto it and I want to be able to filter the annotations displayed with a segmented control. I'm using custom annotations with a type variable so I can tell them apart from one another but I haven't been able to find a way to hide and display a subset of annotation views at will. ...

class level annotations vs interfaces

I am looking at some code where class level annotations are used to 'add' properties to certain classes, later using reflection these properties are accessed and used. My question: When is it appropriate to use an annotation to add new fields to a class, instead of using an interface. What are some benefits and drawbacks to this? ...

Converting JBOSS annotations to xml

Good Morning, I was just hoping that someone could point me to a reference that defines about what JBOSS annotations are equivalent to what xml tags. I am particularly interested in these tags: @WebContext in org.jboss.ws.annotation.WebContext and @SecurityDomain in org.jboss.annotation.security.SecurityDomain ...

Add method comment with Jersey

hi, We've been using Jersey for our webservice and it's been great and straightforward. Is there a way to add a small description comment within a method definition (maybe using an annotation like @Description): @GET @Path("/schema/classes/") @Produces( { APPLICATION_RDF, TEXT_N3, APPLICATION_JSON }) @Description("Lists all ontology cl...

Is package level annotations still available on EJB3 to map entities on JPA/Hibernate?

The Problem: I have two complementary projects, a base one (Base Project) with shared entities and a specific one (Specific Project) that needs to query the entities from the first project. They both access the same database, but in different schemes and different users/grants. Nonetheless, both have at least 'SELECT' grant on the shar...

How do you define an @interface in Scala?

How does one create an @interface in Scala? I honestly feel stupid asking that question, but I can't find the syntax for this anywhere. I know that you can consume them, but how do you actually define new ones in Scala? Java: public @interface MyAnnotation { } Scala: ??? ...

Override of an hibernate validator annotation ?

Hello, I would like to override a constraint in hibernate validator. Here is my base class: @Entity @Table(name = "Value") @Inheritance(strategy = InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name = "valueType", discriminatorType = DiscriminatorType.STRING) public abstract class Value extends CommonTable { private String ...

Findbugs Annotations - Do I need annotation.jar and jsr305.jar in my deployed code?

So, I would like to use the findbugs annotations to suppress warnings we deem ok code. Do we need to deploy the annotation.jar and jsr305.jar into our production runtime, or do we only need these jars in the classpath for our Eclipse project and our unix build environment? ...

Seam unit testing with exception filter and expectedExceptions annotation

I've got a unit test for a Seam component that should fail if a value isn't provided in the context before the backing bean is created. I've been able to test this manually but would like to cover this scenario with a unit test. I'm basically getting a org.jboss.seam.InstantiationException caused by a java.lang.IllegalArgumentException ...

Java : accessing annotations through reflection

Here is a test class : import java.lang.annotation.Annotation; import java.lang.reflect.Method; public class TestAnnotations { @interface Annotate{} @Annotate public void myMethod(){} public static void main(String[] args) { try{ Method[] methods = TestAnnotations.class.getDeclaredMethods(); ...

Are java annotations with typed class parameter possible?

Best done with examples. Bare with me.. Let's supposed i have this interface: public interface MyInterface { void doStuff(); } With a concrete implementation: public class HardCoreConcrete implements MyInterface { void doStuff() { // i really do stuff, honest } } And suppose i have this annotation: @Target(Element...

Java multiple class compositing and boiler plate reduction

We all know why Java does/should not have multiple inheritance. So this is not questioning about what has already been debated till-cows-come-home. This discusses what we would do when we wish to create a class that has the characteristics of two or more other classes. Probably, most of us would do this to "inherit" from three classes....

Jersey, Spring, Tomcat and Security Annotations

I need to secure a simple jersey RESTful API in a Tomcat 6.0.24 container. I'd like to keep the authentication with Basic Authentication using the tomcat-users.xml file to define the users and roles (this is for now, like I said its small). Now, for authorization I'd like to be able to use the JSR 250 annotations like @RolesAllowed, @Pe...

how to copy youtube annotations

For example this video How to Fix Bicycles : How to Tighten the Brakes on a Bicycle http://www.youtube.com/watch?v=zqMDye2Jumg&NR=1&feature=fvwp there are annotations, basically a transcript of what the expert says. is there any way to copy those annotations? transcribing by hand gets tedious ...

Spring: constructor injection of primitive values (properties) with annotation based configuration

I'm trying to configure a class with Annotation based configuration in Spring 3, which takes primitive values as its constructor arguments: @Component class MyBean { MyBean(String arg1, String arg2) { // ... } } And an application context like this: <beans [...]> <context:component-scan base-package="com.example" /> <cont...

Ignore Hibernate @Where annotation

I have an Entity which has an association to another Entity annotated with @Where, like so public class EntityA { @OneToMany @Where(...) private List<EntityB> entityBList; } Recently the inevitable has happened, I need to load EntityB's that don't conform to the @Where clause. I could remove the @Where annotation, but it...

Hibernate: Many-to-one using Formula

Hi everybody, I hope someone can help me find an answer. I'm working with a legacy database and I can't change any of the preexisting tables, because other apps depend on them. I have three main existing tables: A,B,C. A has a column with reference to B(many to one relation). The problem is that it should have a relation to C not to B...

Why is javac failing on @Override annotation

Eclipse is adding @Override annotations when I implement methods of an interface. Eclipse seems to have no problem with this. And our automated build process from Cruise Control seems to have no problem with this. But when I build from the command-line, with ant running javac, I get this error: [javac] C:\path\project\src\com\us\MyCl...

DataNucleus Enhancer, JDO and Specifying Column Names

I'm working with DataNucleus as part of a Google App Engine project and I'm having a bit of trouble with columns in persistence. @PrimaryKey(column = "user_id") @Column(name = "user_id") @Persistent(name = "user_id", column = "user_id", valueStrategy = IdGeneratorStrategy.IDENTITY) private Key m_id; @Column(name = "user_name") @Persist...

@Transactional not working with spring and hibernate

I am trying to do spring transactions with @Transactional without any success. Excerpt from my applicationContext.xml: <context:annotation-config /> <context:component-scan base-package="hibex" /> <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource" p:driverClassName="org.postgresql.Driver"...