List of usage examples for com.badlogic.gdx.utils.reflect ReflectionException ReflectionException
public ReflectionException(Throwable cause)
From source file:es.eucm.ead.engine.Accessor.java
License:Open Source License
/** * Retrieves the property with the given name from the given object via * reflection ({@link ClassReflection}). * // w ww. j av a2s. c o m * @param parent * The object to retrieve from * @param propertyName * The name of the property to be retrieved. * @return The {@link Property} wrapper. Allows reading and writing the * value of the property * @throws ReflectionException * if the property cannot be accessed */ private Property getProperty(String fullId, Object parent, String propertyName) throws ReflectionException { Class currentClass = parent.getClass(); while (currentClass != null) { for (Field declaredField : ClassReflection.getDeclaredFields(currentClass)) { if (declaredField.getName().equals(propertyName)) { declaredField.setAccessible(true); return obtainProperty(declaredField, fullId, parent); } } currentClass = currentClass.getSuperclass(); } throw new ReflectionException("Property " + propertyName + " could not be accessed by reflection"); }