All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.mapstruct.ap.spi.FreeBuilderAccessorNamingStrategy Maven / Gradle / Ivy

There is a newer version: 1.6.3
Show newest version
/*
 * Copyright MapStruct Authors.
 *
 * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
 */
package org.mapstruct.ap.spi;

import javax.lang.model.element.ExecutableElement;

import org.mapstruct.util.Experimental;

/**
 * Accessor naming strategy for FreeBuilder.
 * FreeBuilder adds a lot of other methods that can be considered as fluent setters. Such as:
 * 
    *
  • {@code from(Target)}
  • *
  • {@code mapXXX(UnaryOperator)}
  • *
  • {@code mutateXXX(Consumer)}
  • *
  • {@code mergeFrom(Target)}
  • *
  • {@code mergeFrom(Target.Builder)}
  • *
*

* When the JavaBean convention is not used with FreeBuilder then the getters are non standard and MapStruct * won't recognize them. Therefore one needs to use the JavaBean convention in which the fluent setters * start with {@code set}. * * @author Filip Hrisafov */ @Experimental("The FreeBuilder accessor naming strategy might change in a subsequent release") public class FreeBuilderAccessorNamingStrategy extends DefaultAccessorNamingStrategy { @Override protected boolean isFluentSetter(ExecutableElement method) { // When using FreeBuilder one needs to use the JavaBean convention, which means that all setters will start // with set return false; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy