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