001    package org.tynamo.descriptor.annotation;
002    
003    import org.apache.tapestry5.ioc.annotations.AnnotationUseContext;
004    import org.apache.tapestry5.ioc.annotations.UseWith;
005    import org.tynamo.descriptor.annotation.handlers.CollectionDescriptorAnnotationHandler;
006    import org.tynamo.descriptor.annotation.handlers.HandledBy;
007    
008    import java.lang.annotation.*;
009    
010    @Retention(RetentionPolicy.RUNTIME)
011    @Target({ElementType.FIELD, ElementType.METHOD})
012    @HandledBy(CollectionDescriptorAnnotationHandler.class)
013    @Documented
014    @UseWith(AnnotationUseContext.BEAN)
015    public @interface Collection
016    {
017    
018            public static final String DEFAULT_inverse = "";
019            public static final String DEFAULT_addExpression = "";
020            public static final String DEFAULT_removeExpression = "";
021            public static final String DEFAULT_swapExpression = "";
022    
023            /**
024             * The field in the other end of the realtionship. Required for @OneToMany @Collection(child=false)
025             *
026             * @return
027             */
028            public String inverse() default "";
029    
030            /**
031             * Child collections will not allow you to choose from all possible instances of the element type, only to create new
032             * instances and remove instances from the collection.
033             *
034             * @return
035             */
036            public boolean child() default false;
037    
038            public String addExpression() default "";
039    
040            public String removeExpression() default "";
041    
042            public String swapExpression() default "";
043    
044            public boolean allowRemove() default true;
045    
046    }