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

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

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

import io.github.sporklibrary.binders.FieldBinder;
import io.github.sporklibrary.interfaces.ObjectBinder;
import io.github.sporklibrary.reflection.AnnotatedField;

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

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

	private final FieldBinder fieldBinder;

	AnnotatedFieldBinder(FieldBinder fieldBinder, Set> annotatedFields)
	{
		this.fieldBinder = fieldBinder;
		this.annotatedFields = annotatedFields;
	}

	/**
	 * {@inheritDoc}
	 */
	@Override
	public void bind(Object object)
	{
		// Bind all fields for this object
		for (AnnotatedField annotated_field : annotatedFields)
		{
			fieldBinder.bind(object, annotated_field);
		}
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy