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

com.artemis.link.MutatorUtil Maven / Gradle / Ivy

There is a newer version: 2.3.0
Show newest version
package com.artemis.link;

import com.artemis.utils.reflect.ClassReflection;
import com.artemis.utils.reflect.ReflectionException;

final class MutatorUtil {
	private MutatorUtil() {}

	static  T getGeneratedMutator(LinkSite linkSite) {
		Class[] possibleMutators = linkSite.field.getDeclaringClass().getDeclaredClasses();
		String mutatorName = "Mutator_" + linkSite.field.getName();
		for (int i = 0, s = possibleMutators.length; s > i; i++) {
			if (mutatorName.equals(possibleMutators[i].getSimpleName())) {
				try {
					return  (T) ClassReflection.newInstance(possibleMutators[i]);
				} catch (ReflectionException e) {
					throw new RuntimeException(e);
				}
			}
		}

		return null;
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy