All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.ebeaninternal.server.deploy.ElementHelpMap Maven / Gradle / Ivy

There is a newer version: 15.8.0
Show newest version
package io.ebeaninternal.server.deploy;

import io.ebean.bean.BeanCollection;
import io.ebean.common.BeanMap;

import java.util.LinkedHashMap;
import java.util.Map;

final class ElementHelpMap implements ElementHelp {

  @Override
  public ElementCollector createCollector() {
    return new Collector();
  }

  private static class Collector implements ElementCollector {

    private final Map map = new LinkedHashMap<>();

    @Override
    public void addElement(Object element) {
      throw new IllegalStateException("never called");
    }

    @Override
    public void addKeyValue(Object key, Object element) {
      map.put(key, element);
    }

    @Override
    public Object collection() {
      BeanMap beanMap = new BeanMap<>(map);
      beanMap.setModifyListening(BeanCollection.ModifyListenMode.ALL);
      return beanMap;
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy