io.ebeaninternal.server.persist.dmlbind.MatchedImportedEmbedded Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ebean Show documentation
Show all versions of ebean Show documentation
composite of common runtime dependencies for all platforms
package io.ebeaninternal.server.persist.dmlbind;
import io.ebean.bean.EntityBean;
import io.ebeaninternal.server.deploy.BeanProperty;
import io.ebeaninternal.server.deploy.BeanPropertyAssocOne;
/**
* Matches local embedded id properties to 'matching' properties from a
* ManyToOne associated bean that is a 'imported primary key'.
*/
class MatchedImportedEmbedded implements MatchedImportedProperty {
private final BeanProperty localProp;
private final BeanPropertyAssocOne> assocOne;
private final BeanProperty foreignProp;
MatchedImportedEmbedded(BeanProperty localProp, BeanPropertyAssocOne> assocOne, BeanProperty foreignProp) {
this.localProp = localProp;
this.assocOne = assocOne;
this.foreignProp = foreignProp;
}
@Override
public void populate(EntityBean sourceBean, EntityBean embeddedId) {
Object assocBean = assocOne.getValue(sourceBean);
if (assocBean == null) {
throw new NullPointerException("The assoc bean for " + assocOne + " is null?");
}
Object value = foreignProp.getValue((EntityBean) assocBean);
localProp.setValue(embeddedId, value);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy