001package com.mrivanplays.annotationconfig.core; 002 003import java.lang.reflect.Field; 004 005/** 006 * Represents a field type resolver. 007 * 008 * <p>A field type resolver is an raw argument resolver, read from the config, and then parsed to a 009 * field type. 010 */ 011public interface FieldTypeResolver { 012 013 /** 014 * AnnotationConfig will call this method whenever it is setting a config object's field, if a 015 * field type resolver was specified on the field. 016 * 017 * @param value config value 018 * @param field field we're resolving 019 * @return value with type of the field this resolver was specified on. 020 * @throws Exception something wrong occurred 021 */ 022 Object toType(Object value, Field field) throws Exception; 023 024 /** 025 * AnnotationConfig will call this method before calling {@link #toType(Object, Field)} in order 026 * to see if it should proceed processing the value convertion. 027 * 028 * @param fieldType field type 029 * @return should resolve or not 030 */ 031 boolean shouldResolve(Class<?> fieldType); 032}