Package org.mapstruct.ap.model.source

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


         * exists.
         */
        private Assignment resolveViaMethod(Type sourceType, Type targetType, boolean considerBuiltInMethods) {

            // first try to find a matching source method
            SourceMethod matchingSourceMethod = getBestMatch( methods, sourceType, targetType );

            if ( matchingSourceMethod != null ) {
                return getMappingMethodReference( matchingSourceMethod, targetType );
            }

View Full Code Here


        for ( SourceMethod method : methods ) {
            if ( !method.overridesMethod() ) {
                continue;
            }

            SourceMethod reverseMappingMethod = getReverseMappingMethod( methods, method );

            boolean hasFactoryMethod = false;
            if ( method.isIterableMapping() ) {

                IterableMappingMethod.Builder builder = new IterableMappingMethod.Builder();
                if ( method.getIterableMapping() == null && reverseMappingMethod != null &&
                    reverseMappingMethod.getIterableMapping() != null ) {
                    method.setIterableMapping( reverseMappingMethod.getIterableMapping() );
                }

                String dateFormat = null;
                List<TypeMirror> qualifiers = null;
                if ( method.getIterableMapping() != null ) {
                    dateFormat = method.getIterableMapping().getDateFormat();
                    qualifiers = method.getIterableMapping().getQualifiers();
                }

                IterableMappingMethod iterableMappingMethod = builder
                    .mappingContext( mappingContext )
                    .method( method )
                    .dateFormat( dateFormat )
                    .qualifiers( qualifiers )
                    .build();

                hasFactoryMethod = iterableMappingMethod.getFactoryMethod() != null;
                mappingMethods.add( iterableMappingMethod );
            }
            else if ( method.isMapMapping() ) {

                MapMappingMethod.Builder builder = new MapMappingMethod.Builder();

                if ( method.getMapMapping() == null && reverseMappingMethod != null &&
                    reverseMappingMethod.getMapMapping() != null ) {
                    method.setMapMapping( reverseMappingMethod.getMapMapping() );
                }
                String keyDateFormat = null;
                String valueDateFormat = null;
                List<TypeMirror> keyQualifiers = null;
                List<TypeMirror> valueQualifiers = null;
View Full Code Here

            method.getMappings().putAll( newMappings );
        }
    }

    private SourceMethod getReverseMappingMethod(List<SourceMethod> rawMethods, SourceMethod method) {
        SourceMethod result = null;
        InheritInverseConfigurationPrism reversePrism = InheritInverseConfigurationPrism.getInstanceOn(
            method.getExecutable()
        );

        if ( reversePrism != null ) {
View Full Code Here

    private List<SourceMethod> retrieveMethods(TypeElement usedMapper, TypeElement mapperToImplement) {
        List<SourceMethod> methods = new ArrayList<SourceMethod>();

        for ( ExecutableElement executable : methodsIn( allEnclosingElementsIncludeSuper( usedMapper ) ) ) {
            if ( isNotObjectEquals( executable ) && wasNotYetOverridden( methods, executable ) ) {
                SourceMethod method = getMethod( usedMapper, executable, mapperToImplement );
                if ( method != null ) {
                    methods.add( method );
                }
            }
        }
View Full Code Here

            // retrieve annotations
            Set<TypeMirror> combinedAnnotations = new HashSet<TypeMirror>();

            // first from the method itself
            SourceMethod candidateSM = (SourceMethod) candidate;
            List<? extends AnnotationMirror> methodAnnotations = candidateSM.getExecutable().getAnnotationMirrors();
            for ( AnnotationMirror methodAnnotation : methodAnnotations ) {
                addOnlyWhenQualifier( combinedAnnotations, methodAnnotation );
            }

            // then from the mapper (if declared)
View Full Code Here

        // only true source methods are qualifying
        if ( !(mappingMethod instanceof SourceMethod) ) {
            return methods;
        }

        SourceMethod sourceMappingMethod = (SourceMethod) mappingMethod;

        List<T> nameMatches = new ArrayList<T>();
        List<T> scopeMatches = new ArrayList<T>();
        List<T> nameAndScopeMatches = new ArrayList<T>();

        for ( T candidate : methods ) {
            if ( !( candidate instanceof SourceMethod ) ) {
                continue;
            }

            SourceMethod candidateMethod = (SourceMethod) candidate;
            XmlElementDeclPrism xmlElememtDecl = XmlElementDeclPrism.getInstanceOn( candidateMethod.getExecutable() );

            if ( xmlElememtDecl == null ) {
                continue;
            }
View Full Code Here

TOP

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

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.