| Classes in this File | Line Coverage | Branch Coverage | Complexity | |||||||
| InitialValueAnnotationHandler |
|
| 0.0;0 |
| 1 | 0 | package org.trails.descriptor.annotation; |
| 2 | ||
| 3 | import org.apache.commons.lang.Validate; |
|
| 4 | import org.trails.descriptor.IPropertyDescriptor; |
|
| 5 | ||
| 6 | /** |
|
| 7 | * Creates a {@link InitialValueDescriptorExtension} using the |
|
| 8 | * information retrieved from a {@link InitialValue} annotation. |
|
| 9 | * |
|
| 10 | * @author pruggia |
|
| 11 | */ |
|
| 12 | 0 | public class InitialValueAnnotationHandler extends AbstractAnnotationHandler |
| 13 | implements DescriptorAnnotationHandler<InitialValue, IPropertyDescriptor> |
|
| 14 | { |
|
| 15 | ||
| 16 | /** |
|
| 17 | * Creates a {@link InitialValueDescriptorExtension} and adds it to |
|
| 18 | * the property descriptor. |
|
| 19 | * |
|
| 20 | * @param annotation Annotation added to the property. It cannot be null. |
|
| 21 | * @param descriptor The property descriptor. It cannot be null. |
|
| 22 | * @return The provided descriptor with the extension added. |
|
| 23 | */ |
|
| 24 | public IPropertyDescriptor decorateFromAnnotation(final InitialValue annotation, |
|
| 25 | final IPropertyDescriptor descriptor) |
|
| 26 | { |
|
| 27 | 0 | Validate.notNull(annotation, "The annotation cannot be null"); |
| 28 | 0 | Validate.notNull(descriptor, "The descriptor cannot be null"); |
| 29 | 0 | InitialValueDescriptorExtension extension = new InitialValueDescriptorExtension(annotation.value()); |
| 30 | 0 | descriptor.addExtension(InitialValueDescriptorExtension.class |
| 31 | 0 | .getName(), extension); |
| 32 | 0 | return descriptor; |
| 33 | } |
|
| 34 | } |
|
| 35 |