List of usage examples for org.apache.commons.collections4 Factory Factory
Factory
From source file:cz.lidinsky.editor.Writer.java
public Factory<String> transform(Pair<Object, AccessibleObject> param) { final Object object = param.getLeft(); final AccessibleObject member = param.getRight(); Class dataType = ObjectMapUtils.getValueDataType(member); if (java.awt.Color.class.isAssignableFrom(dataType)) { return new Factory<String>() { public String create() { try { Object rawValue = ObjectMapUtils.get(object, member, true); if (rawValue == null) { return "<null>"; } else { return Integer.toString(((Color) rawValue).getRGB()); }/*from w w w . j a v a 2 s . co m*/ } catch (Exception e) { throw new CommonException().setCause(e) .set("message", "Exception while reading from a getter!").set("object", object) .set("member", member).set("accessibility", true); } } }; } else { return ObjectMapUtils.stringGetterFactory(true).transform(param); } }
From source file:org.opendolphin.mvndemo.clientlazy.DemoController.java
private void initLazyModle(String[] colNames) { lazyModel.clear();//from w ww . ja v a 2s .c om Factory<SimpleStringProperty> factory = new Factory<SimpleStringProperty>() { public SimpleStringProperty create() { return new SimpleStringProperty("..."); } }; for (String colName : colNames) { Map<String, SimpleStringProperty> colProps = LazyMap .lazyMap(new HashMap<String, SimpleStringProperty>(), factory); lazyModel.add(colProps); } }