
org.mapstruct.ap.internal.model.AnnotatedSetter Maven / Gradle / Ivy
/*
* 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.internal.model;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import org.mapstruct.ap.internal.model.common.Type;
/**
* @author Lucas Resch
*/
public class AnnotatedSetter extends GeneratedTypeMethod {
private final Field field;
private final Collection methodAnnotations;
private final Collection parameterAnnotations;
public AnnotatedSetter(Field field, Collection methodAnnotations,
Collection parameterAnnotations) {
this.field = field;
this.methodAnnotations = methodAnnotations;
this.parameterAnnotations = parameterAnnotations;
}
@Override
public Set getImportTypes() {
Set importTypes = new HashSet<>( field.getImportTypes() );
for ( Annotation annotation : methodAnnotations ) {
importTypes.addAll( annotation.getImportTypes() );
}
for ( Annotation annotation : parameterAnnotations ) {
importTypes.addAll( annotation.getImportTypes() );
}
return importTypes;
}
public Type getType() {
return field.getType();
}
public String getFieldName() {
return field.getVariableName();
}
public Collection getMethodAnnotations() {
return methodAnnotations;
}
public Collection getParameterAnnotations() {
return parameterAnnotations;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy