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

com.nu.art.reflection.extractor.AnnotatbleExtractor Maven / Gradle / Ivy

The newest version!
/*
 * The reflection project, is collection of reflection tools I've picked up
 * along the way, use it wisely!
 *
 * Copyright (C) 2018  Adam van der Kruk aka TacB0sS
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.nu.art.reflection.extractor;

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

/**
 * The injectee type that this interface supports.
 *
 * @author TacB0sS
 */
public abstract class AnnotatbleExtractor
	extends Extractor {

	protected final Class annotationType;

	public AnnotatbleExtractor(Class annotationType) {
		super();
		this.annotationType = annotationType;
	}

	// protected abstract  RealType getInstance(Class realType, KeyType key);
	//
	// protected abstract  RealType[] getArray(Class realType, KeyType key);
	@Override
	protected void setValueForField(Field field, Object fieldValue) {
		setValueFromAnnotationAndField(field.getAnnotation(annotationType), field, fieldValue);
	}

	protected abstract void setValueFromAnnotationAndField(KeyType annotation, Field field, Object fieldValue);
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy