Search in sources :

Example 1 with ExecutableElementAccessor

use of org.mapstruct.ap.internal.util.accessor.ExecutableElementAccessor in project mapstruct by mapstruct.

the class Executables method addNotYetOverridden.

/**
 * @param alreadyCollected methods that have already been collected and to which the not-yet-overridden methods will
 *            be added
 * @param methodsToAdd methods to add to alreadyAdded, if they are not yet overridden by an element in the list
 * @param parentType the type for with elements are collected
 */
private static void addNotYetOverridden(Elements elementUtils, List<Accessor> alreadyCollected, List<ExecutableElement> methodsToAdd, TypeElement parentType) {
    List<Accessor> safeToAdd = new ArrayList<Accessor>(methodsToAdd.size());
    for (ExecutableElement toAdd : methodsToAdd) {
        if (isNotObjectEquals(toAdd) && wasNotYetOverridden(elementUtils, alreadyCollected, toAdd, parentType)) {
            safeToAdd.add(new ExecutableElementAccessor(toAdd));
        }
    }
    alreadyCollected.addAll(0, safeToAdd);
}
Also used : ExecutableElement(javax.lang.model.element.ExecutableElement) ArrayList(java.util.ArrayList) ExecutableElementAccessor(org.mapstruct.ap.internal.util.accessor.ExecutableElementAccessor) Accessor(org.mapstruct.ap.internal.util.accessor.Accessor) VariableElementAccessor(org.mapstruct.ap.internal.util.accessor.VariableElementAccessor) ExecutableElementAccessor(org.mapstruct.ap.internal.util.accessor.ExecutableElementAccessor)

Aggregations

ArrayList (java.util.ArrayList)1 ExecutableElement (javax.lang.model.element.ExecutableElement)1 Accessor (org.mapstruct.ap.internal.util.accessor.Accessor)1 ExecutableElementAccessor (org.mapstruct.ap.internal.util.accessor.ExecutableElementAccessor)1 VariableElementAccessor (org.mapstruct.ap.internal.util.accessor.VariableElementAccessor)1