com.artemis.link.MutatorUtil Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of artemis-odb Show documentation
Show all versions of artemis-odb Show documentation
Fork of Artemis Entity System Framework.
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