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

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

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

import io.ebeaninternal.server.query.SqlBeanLoad;

import java.util.Set;

@SuppressWarnings("rawtypes")
public final class DynamicPropertyAggregationFormulaMTO extends DynamicPropertyAggregationFormula {

  private final BeanPropertyAssocOne prop;
  private final Set includes;

  DynamicPropertyAggregationFormulaMTO(BeanPropertyAssocOne prop, String name, String parsedFormula, boolean aggregate, BeanProperty asTarget, String alias, Set includes) {
    super(name, prop.idScalarType(), parsedFormula, aggregate, asTarget, alias);
    this.prop = prop;
    this.includes = includes;
  }

  @Override
  public boolean isAggregationManyToOne() {
    return true;
  }

  @Override
  public void extraIncludes(Set predicateIncludes) {
    predicateIncludes.addAll(includes);
  }

  @Override
  public void load(SqlBeanLoad sqlBeanLoad) {
    Object value;
    try {
      value = prop.read(sqlBeanLoad.ctx());
    } catch (Exception e) {
      sqlBeanLoad.ctx().handleLoadError(fullName, e);
      return;
    }
    if (asTarget != null) {
      sqlBeanLoad.load(asTarget, value);
    }
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy