474849505152535455
public static Object getFieldValue(Object entity, String fieldName) { try { Field field = getField(entity, fieldName); return field.get(entity); } catch (Exception e) { throw new HateoasInjectException(e); } }
6465666768697071
public static void setField(Object entity, String fieldName, Object value) { try { Field field = getField(entity, fieldName); field.set(entity, value); } catch (Exception e) { throw new HateoasInjectException(e); } }
6768697071727374
return target; } try { return injectLinks(iterator(), target, injector, linkProducer, verbosity); } catch (Exception e) { throw new HateoasInjectException(e); } }
57585960616263646566
} HateoasLinkInjector<Object> injector = INJECTOR_MAPPING.get(entity.getClass()); if(injector == null){ throw new HateoasInjectException("No suitable injector found for " + entity.getClass()); } return injector.injectLinks(entity, objectLinkProducer, verbosity); }
6869707172737475
7778798081828384
public static Object getFieldValueHierarchical(Object entity, String fieldName) { try { Field field = getFieldHierarchical(entity.getClass(), fieldName); return field.get(entity); } catch (Exception e) { throw new HateoasInjectException(e); } }
144145146147148149150151152153154
} } while (!Object.class.equals(superClass)); } } catch (Exception e) { throw new HateoasInjectException(e); } if (!done) { throw new HateoasInjectException("Field not found: " + fieldName); } }
156157158159160161162163
8081828384858687888990
valid = true; break; } } if (!valid){ throw new HateoasInjectException("DTO's must have no arg constructor. Check " + entity.getClass().getName()); } CtClass newClass = CLASS_POOL.makeClass(newClassName); newClass.setSuperclass(CLASS_POOL.get(entity.getClass().getName())); CtConstructor ctConstructor = new CtConstructor(new CtClass[0], newClass);