예제 #1
0
  @SuppressWarnings("unchecked")
  public static <T> T createBean(
      String className, AutowireCapableBeanFactory beanFactory, int autowire) {

    Class<?> beanClass = SpringUtils.classForName(className);
    return (T) beanFactory.createBean(beanClass, autowire, false);
  }
예제 #2
0
  @SuppressWarnings("unchecked")
  public Object getValue() {
    Collection<Object> collection = null;
    if (getEditorBinding() != null) {
      collection = (Collection<Object>) getEditorBinding().getValue();
    }
    if (collection == null) {
      collection = SpringUtils.newInstance(collectionClass);
    }

    ArrayList<?> oldValues = Generics.newArrayList(collection);
    collection.clear();

    for (Object value : selectedValues) {
      int i = oldValues.indexOf(value);
      if (i >= 0) {
        value = oldValues.get(i);
      }
      collection.add(value);
    }
    return collection;
  }