List of usage examples for org.apache.wicket.core.util.lang PropertyResolver getPropertyGetter
public static Method getPropertyGetter(final String expression, final Object object)
From source file:org.apache.syncope.fit.console.AbstractConsoleITCase.java
License:Apache License
protected <V extends Serializable> Component findComponentByProp(final String property, final String searchPath, final V key) { Component component = TESTER.getComponentFromLastRenderedPage(searchPath); return (component instanceof MarkupContainer ? MarkupContainer.class.cast(component) : component.getPage()) .visitChildren(ListItem.class, new IVisitor<ListItem<?>, Component>() { @Override/*ww w . j a v a2 s . c o m*/ public void component(final ListItem<?> object, final IVisit<Component> visit) { try { Method getter = PropertyResolver.getPropertyGetter(property, object.getModelObject()); if (getter != null && getter.invoke(object.getModelObject()).equals(key)) { visit.stop(object); } } catch (Exception e) { LOG.error("Error invoke method", e); } } }); }
From source file:org.apache.syncope.fit.console.LogsITCase.java
License:Apache License
private Component searchLog(final String property, final String searchPath, final String key) { Component component = TESTER.getComponentFromLastRenderedPage(searchPath); Component result = component.getPage().visitChildren(ListItem.class, new IVisitor<ListItem<LoggerTO>, Component>() { @Override/* w ww . j a va 2 s . c o m*/ public void component(final ListItem<LoggerTO> object, final IVisit<Component> visit) { try { if (object.getModelObject() instanceof LoggerTO && PropertyResolver.getPropertyGetter(property, object.getModelObject()) .invoke(object.getModelObject()).equals(key)) { visit.stop(object); } } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { LOG.error("Error invoke method", ex); } } }); return result; }