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

io.github.sporklibrary.caching.AnnotatedMethodBinder Maven / Gradle / Ivy

There is a newer version: 3.2.0
Show newest version
package io.github.sporklibrary.caching;

import io.github.sporklibrary.binders.MethodBinder;
import io.github.sporklibrary.interfaces.ObjectBinder;
import io.github.sporklibrary.reflection.AnnotatedMethod;

import java.lang.annotation.Annotation;
import java.util.Set;

/**
 * A binder that caches method bindings for a specific class.
 *
 * @param  the annotation type that is being bound
 */
class AnnotatedMethodBinder implements ObjectBinder
{
	private final Set> annotatedMethods;

	private final MethodBinder methodBinder;

	AnnotatedMethodBinder(MethodBinder methodBinder, Set> annotatedMethods)
	{
		this.methodBinder = methodBinder;
		this.annotatedMethods = annotatedMethods;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public void bind(Object object)
	{
		// Bind all methods for this object
		for (AnnotatedMethod annotated_method : annotatedMethods)
		{
			methodBinder.bind(object, annotated_method);
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy