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

io.ebeaninternal.server.deploy.BeanMapQueryHelp 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.bean.EntityBean;
import io.ebean.common.BeanMap;
import io.ebeaninternal.server.el.ElPropertyValue;
import io.ebeaninternal.server.query.CQueryCollectionAdd;

final class BeanMapQueryHelp implements CQueryCollectionAdd {

  private final ElPropertyValue elGetValue;

  /**
   * Create for a findMap query.
   */
  BeanMapQueryHelp(ElPropertyValue elGetValue) {
    this.elGetValue = elGetValue;
  }

  @Override
  public BeanCollection createEmptyNoParent() {
    return new BeanMap<>();
  }

  @Override
  public void add(BeanCollection collection, EntityBean bean, boolean withCheck) {
    if (bean == null) {
      ((BeanMap) collection).internalPutNull();
    } else {
      Object keyValue = elGetValue.pathGet(bean);
      BeanMap map = ((BeanMap) collection);
      map.internalPutWithCheck(keyValue, bean);
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy