001    package org.tynamo.descriptor.annotation.handlers;
002    
003    import org.tynamo.descriptor.CollectionDescriptor;
004    import org.tynamo.descriptor.annotation.Collection;
005    
006    public class CollectionDescriptorAnnotationHandler implements DescriptorAnnotationHandler<Collection, CollectionDescriptor>
007    {
008    
009            public CollectionDescriptor decorateFromAnnotation(Collection annotation, CollectionDescriptor descriptor)
010            {
011                    descriptor.setChildRelationship(annotation.child());
012                    descriptor.setAllowRemove(annotation.allowRemove());
013    
014                    if (!Collection.DEFAULT_inverse.equals(annotation.inverse()))
015                    {
016                            descriptor.setInverseProperty(annotation.inverse());
017                    }
018    
019                    if (!Collection.DEFAULT_addExpression.equals(annotation.addExpression()))
020                    {
021                            descriptor.setAddExpression(annotation.addExpression());
022                    }
023    
024                    if (!Collection.DEFAULT_removeExpression.equals(annotation.removeExpression()))
025                    {
026                            descriptor.setRemoveExpression(annotation.removeExpression());
027                    }
028    
029                    if (!Collection.DEFAULT_swapExpression.equals(annotation.swapExpression()))
030                    {
031                            descriptor.setSwapExpression(annotation.swapExpression());
032                    }
033    
034    
035                    return descriptor;
036            }
037    }