@Override public BeanCollection<?> createReferenceIfNull(EntityBean parentBean) { Object v = getValue(parentBean); if (v instanceof BeanCollection<?>) { BeanCollection<?> bc = (BeanCollection<?>) v; return bc.isReference() ? bc : null; } else if (v != null) { return null; } else { return createReference(parentBean); } }
/** * Check for lazy loading of many property. */ private boolean lazyLoadMany(EntityBeanIntercept ebi, int lazyLoadProperty) { BeanProperty lazyLoadBeanProp = propertiesIndex[lazyLoadProperty]; if (lazyLoadBeanProp instanceof BeanPropertyAssocMany<?>) { BeanPropertyAssocMany<?> manyProp = (BeanPropertyAssocMany<?>) lazyLoadBeanProp; manyProp.createReference(ebi.getOwner()); ebi.setLoadedLazy(); return true; } return false; }
/** * Reset the many properties to be empty and ready for reloading. * <p> * Used in bean refresh. */ public void resetMany(EntityBean bean) { Object value = getValue(bean); if (value instanceof BeanCollection) { // reset the collection back to empty ((BeanCollection<?>) value).reset(bean, name); } else { createReference(bean); } }
@Override public BeanCollection<?> createReferenceIfNull(EntityBean parentBean) { Object v = getValue(parentBean); if (v instanceof BeanCollection<?>) { BeanCollection<?> bc = (BeanCollection<?>) v; return bc.isReference() ? bc : null; } else if (v != null) { return null; } else { return createReference(parentBean); } }
/** * Reset the many properties to be empty and ready for reloading. * <p> * Used in bean refresh. */ public void resetMany(EntityBean bean) { Object value = getValue(bean); if (value instanceof BeanCollection) { // reset the collection back to empty ((BeanCollection<?>) value).reset(bean, name); } else { createReference(bean); } }
/** * Check for lazy loading of many property. */ private boolean lazyLoadMany(EntityBeanIntercept ebi, int lazyLoadProperty) { BeanProperty lazyLoadBeanProp = propertiesIndex[lazyLoadProperty]; if (lazyLoadBeanProp instanceof BeanPropertyAssocMany<?>) { BeanPropertyAssocMany<?> manyProp = (BeanPropertyAssocMany<?>) lazyLoadBeanProp; manyProp.createReference(ebi.getOwner()); ebi.setLoadedLazy(); return true; } return false; }