Package org.mapstruct.ap.model.source

Examples of org.mapstruct.ap.model.source.Mapping


                        }

                        PropertyMapping newPropertyMapping = null;
                        ExecutableElement sourceAccessor = getSourceAccessor( targetProperty.getKey(), candidates );
                        if ( sourceAccessor != null ) {
                            Mapping mapping = method.getSingleMappingByTargetPropertyName( targetProperty.getKey() );

                            SourceReference sourceRef = new SourceReference.BuilderFromProperty()
                                    .sourceParameter( sourceParameter )
                                    .type( ctx.getTypeFactory().getReturnType( sourceAccessor ) )
                                    .accessor( sourceAccessor )
                                    .name( targetProperty.getKey() )
                                    .build();

                            newPropertyMapping = new PropertyMappingBuilder()
                                    .mappingContext( ctx )
                                    .souceMethod( method )
                                    .targetAccessor( targetProperty.getValue() )
                                    .targetPropertyName( targetProperty.getKey() )
                                    .sourceReference( sourceRef )
                                    .qualifiers( mapping != null ? mapping.getQualifiers() : null )
                                    .dateFormat( mapping != null ? mapping.getDateFormat() : null )
                                    .build();

                            // candidates are handled
                            candidates.clear();
                        }
View Full Code Here


        Map<String, List<Mapping>> newMappings = new HashMap<String, List<Mapping>>();

        if ( forwardMappingMethod != null && !forwardMappingMethod.getMappings().isEmpty() ) {
            for ( List<Mapping> mappings : forwardMappingMethod.getMappings().values() ) {
                for ( Mapping forwardMapping : mappings ) {
                    Mapping reversed = forwardMapping.reverse( method, messager, typeFactory );
                    if ( reversed != null ) {
                        List<Mapping> mappingsOfProperty = newMappings.get( reversed.getTargetName() );
                        if ( mappingsOfProperty == null ) {
                            mappingsOfProperty = new ArrayList<Mapping>();
                            newMappings.put( reversed.getTargetName(), mappingsOfProperty );
                        }
                        mappingsOfProperty.add( reversed );
                    }
                }
            }
View Full Code Here

        if ( mappingAnnotation != null ) {
            if ( !mappings.containsKey( mappingAnnotation.target() ) ) {
                mappings.put( mappingAnnotation.target(), new ArrayList<Mapping>() );
            }
            Mapping mapping = Mapping.fromMappingPrism( mappingAnnotation, method, messager );
            if ( mapping != null ) {
                mappings.get( mappingAnnotation.target() ).add( mapping );
            }
        }
View Full Code Here

TOP

Related Classes of org.mapstruct.ap.model.source.Mapping

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.