<commit_before>package com.matthewtamlin.spyglass.library.core;

import com.matthewtamlin.spyglass.library.meta_annotations.Default;
import com.matthewtamlin.spyglass.library.meta_annotations.Handler;

import java.lang.annotation.Annotation;
import java.lang.reflect.Field;

import static com.matthewtamlin.java_utilities.checkers.NullChecker.checkNotNull;

public class FieldUtil {
	public static Annotation getHandlerAnnotation(final Field field) {
		for (final Annotation a : field.getDeclaredAnnotations()) {
			if (a.annotationType().isAnnotationPresent(Handler.class)) {
				return a;
			}
		}

		return null;
	}

	public static Annotation getDefaultAnnotation(final Field field) {
		for (final Annotation a : field.getDeclaredAnnotations()) {
			if (a.annotationType().isAnnotationPresent(Default.class)) {
				return a;
			}
		}

		return null;
	}

	public static void assignValueToField(
			final Object fieldParent,
			final Field field,
			final Object value)
			throws SpyglassFieldBindException {

		checkNotNull(field, "Argument 'field' cannot be null.");

		try {
			field.setAccessible(true);
			field.set(fieldParent, value);

		} catch (final SecurityException | IllegalAccessException e) {
			throw new SpyglassFieldBindException("Unable to access field " + field.getName(), e);

		} catch (final IllegalArgumentException e) {
			throw new SpyglassFieldBindException(
					String.format(
							"Unable to assign a value of type %1$s to a field of type %2$s.",
							value == null ? "\'null\'" : value.getClass().getName(),
							field.getType().getName()),
					e);
		}
	}
}<commit_msg>Deleted method assignValueToField()<commit_after>package com.matthewtamlin.spyglass.library.core;

import com.matthewtamlin.spyglass.library.meta_annotations.Default;
import com.matthewtamlin.spyglass.library.meta_annotations.Handler;

import java.lang.annotation.Annotation;
import java.lang.reflect.Field;

public class FieldUtil {
	public static Annotation getHandlerAnnotation(final Field field) {
		for (final Annotation a : field.getDeclaredAnnotations()) {
			if (a.annotationType().isAnnotationPresent(Handler.class)) {
				return a;
			}
		}

		return null;
	}

	public static Annotation getDefaultAnnotation(final Field field) {
		for (final Annotation a : field.getDeclaredAnnotations()) {
			if (a.annotationType().isAnnotationPresent(Default.class)) {
				return a;
			}
		}

		return null;
	}
}
{'fraction_non_alphanumeric': 0.1038907284768212, 'fraction_numerical': 0.0008278145695364238, 'mean_word_length': 4.493181818181818, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7662773', 'n_tokens_mistral': 824, 'n_tokens_neox': 718, 'n_words': 166}