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

trip.spi.helpers.QualifierExtractor Maven / Gradle / Ivy

package trip.spi.helpers;

import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Collection;

import lombok.RequiredArgsConstructor;

@RequiredArgsConstructor
public class QualifierExtractor {

	final Iterable extractors;

	public Collection> extractQualifiersFrom( Field field ){
		final Collection> anns = new ArrayList<>();
		for ( final FieldQualifierExtractor extractor : extractors )
			anns.addAll( extractor.extractQualifiersFrom(field) );
		return anns;
	}

	public boolean isAnnotatedWithQualifierAnnotation( Class ann ){
		for ( final FieldQualifierExtractor extractor : extractors )
			if ( extractor.isAnnotatedWithQualifierAnnotation(ann) )
				return true;
		return false;
	}

	public boolean isASingleElementProvider( Field field ) {
		for ( final FieldQualifierExtractor extractor : extractors )
			if ( extractor.isASingleElementProvider( field ) )
				return true;
		return false;
	}

	public boolean isAManyElementsProvider( Field field ) {
		for ( final FieldQualifierExtractor extractor : extractors )
			if ( extractor.isAManyElementsProvider( field ) )
				return true;
		return false;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy