| protected void setField(Object object, String fieldName, Object value) | { | try | { | Field declaredField = object.getClass().getDeclaredField(fieldName); | if ( !declaredField.isAccessible() ) declaredField.setAccessible(true); | declaredField.set(object, value); | } | catch (Exception e) | { | throw new IllegalArgumentException("could not set field value: " + fieldName, e); | } | } |
But in Seam, there is (Iteration over class hierarchy): | private void initMembers(Class<?> clazz, Context applicationContext) | { | ... | List<Field> selectionFields = new ArrayList<Field>(); | | for (;clazz!=Object.class; clazz = clazz.getSuperclass()) | { | ... | | for (Field field: clazz.getDeclaredFields()) | { | | } | } | | | | We have problem, because we have @In parameter in superclass. SeamTest cant setField for this parameter. Workaround probably is to make something like: setField((Superclass) bean, "x", value); ;) but this is very ugly View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4016324#4016324 Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4016324 _______________________________________________ jboss-user mailing list jboss-user@lists.jboss.org https://lists.jboss.org/mailman/listinfo/jboss-user