Search in sources :

Example 1 with ValueMappingsGem

use of org.mapstruct.ap.internal.gem.ValueMappingsGem in project mapstruct by mapstruct.

the class MethodRetrievalProcessor method getValueMappings.

/**
 * Retrieves the mappings configured via {@code @ValueMapping} from the given
 * method.
 *
 * @param method The method of interest
 *
 * @return The mappings for the given method, keyed by target property name
 */
private List<ValueMappingOptions> getValueMappings(ExecutableElement method) {
    List<ValueMappingOptions> valueMappings = new ArrayList<>();
    ValueMappingGem mappingAnnotation = ValueMappingGem.instanceOn(method);
    ValueMappingsGem mappingsAnnotation = ValueMappingsGem.instanceOn(method);
    if (mappingAnnotation != null) {
        ValueMappingOptions valueMapping = ValueMappingOptions.fromMappingGem(mappingAnnotation);
        if (valueMapping != null) {
            valueMappings.add(valueMapping);
        }
    }
    if (mappingsAnnotation != null) {
        ValueMappingOptions.fromMappingsGem(mappingsAnnotation, method, messager, valueMappings);
    }
    return valueMappings;
}
Also used : ValueMappingOptions(org.mapstruct.ap.internal.model.source.ValueMappingOptions) ArrayList(java.util.ArrayList) ValueMappingsGem(org.mapstruct.ap.internal.gem.ValueMappingsGem) ValueMappingGem(org.mapstruct.ap.internal.gem.ValueMappingGem)

Aggregations

ArrayList (java.util.ArrayList)1 ValueMappingGem (org.mapstruct.ap.internal.gem.ValueMappingGem)1 ValueMappingsGem (org.mapstruct.ap.internal.gem.ValueMappingsGem)1 ValueMappingOptions (org.mapstruct.ap.internal.model.source.ValueMappingOptions)1