@Override public void postConstruct(DynamicEntity entity) { if (DynamicEntityImpl.class.isAssignableFrom(entity.getClass())) { super.postConstruct(entity); } }
@Override public boolean containsProperty(String propertyName) { return dpm.contains(propertyName); }
public void postConstruct(DynamicEntity entity) { // first step, create 'slots' in propertiesMap createSlots((DynamicEntityImpl)entity); // next step, initialize 'slot' values initializeSlotValues((DynamicEntityImpl)entity); }
public boolean isSet(String propertyName) throws DynamicException { if (fetchPropertiesManager().contains(propertyName)) { if (_persistence_getFetchGroup() != null && !_persistence_getFetchGroup().containsAttributeInternal(propertyName)) { return false; } PropertyWrapper wrapper = propertiesMap.get(propertyName); if (wrapper == null) { // properties can be added after constructor is called wrapper = new PropertyWrapper(); propertiesMap.put(propertyName, wrapper); } return wrapper.isSet(); } else { throw DynamicException.invalidPropertyName(fetchPropertiesManager().getType(), propertyName); } }
Field dpmField = dynamicClass.getField(DynamicPropertiesManager.PROPERTIES_MANAGER_FIELD); DynamicPropertiesManager dpm = (DynamicPropertiesManager)dpmField.get(null); dpm.setType(entityType); entityType.setDynamicPropertiesManager(dpm);
@Override public List<String> getPropertiesNames() { return dpm.getPropertyNames(); }
protected void initializeSlotValues(DynamicEntityImpl entity) { getInitializatonPolicy().initializeProperties((DynamicTypeImpl)type, entity); }
/** * Gets internal impl class of {@link DynamicType}. * * @return Dynamic type of this entity * @throws DynamicException if type is null */ public DynamicTypeImpl getType() throws DynamicException { DynamicType type = fetchPropertiesManager().getType(); if (type == null) { throw DynamicException.entityHasNullType(this); } return (DynamicTypeImpl) type; }
public boolean isSet(String propertyName) throws DynamicException { if (fetchPropertiesManager().contains(propertyName)) { if (_persistence_getFetchGroup() != null && !_persistence_getFetchGroup().containsAttributeInternal(propertyName)) { return false; } PropertyWrapper wrapper = propertiesMap.get(propertyName); if (wrapper == null) { // properties can be added after constructor is called wrapper = new PropertyWrapper(); propertiesMap.put(propertyName, wrapper); } return wrapper.isSet(); } else { throw DynamicException.invalidPropertyName(fetchPropertiesManager().getType(), propertyName); } }
Field dpmField = dynamicClass.getField(DynamicPropertiesManager.PROPERTIES_MANAGER_FIELD); DynamicPropertiesManager dpm = (DynamicPropertiesManager)dpmField.get(null); dpm.setType(entityType); entityType.setDynamicPropertiesManager(dpm);
public List<String> getPropertiesNames() { return dpm.getPropertyNames(); }
protected void initializeSlotValues(DynamicEntityImpl entity) { getInitializatonPolicy().initializeProperties((DynamicTypeImpl)type, entity); }
/** * Gets internal impl class of {@link DynamicType}. * * @return Dynamic type of this entity * @throws DynamicException if type is null */ public DynamicTypeImpl getType() throws DynamicException { DynamicType type = fetchPropertiesManager().getType(); if (type == null) { throw DynamicException.entityHasNullType(this); } return (DynamicTypeImpl) type; }
public <T> T get(String propertyName) throws DynamicException { DynamicPropertiesManager dpm = fetchPropertiesManager(); if (dpm.contains(propertyName)) { if (_persistence_getFetchGroup() != null) { String errorMsg = _persistence_getFetchGroup().onUnfetchedAttribute(this, propertyName); if (errorMsg != null) { throw DynamicException.invalidPropertyName(dpm.getType(), propertyName); throw DynamicException.invalidPropertyName(dpm.getType(), propertyName);
descriptor.getJavaClass().getField(DynamicPropertiesManager.PROPERTIES_MANAGER_FIELD); DynamicPropertiesManager dpm = (DynamicPropertiesManager)dpmField.get(null); dpm.setType(entityType); entityType.setDynamicPropertiesManager(dpm);
@Override public void postConstruct(DynamicEntity entity) { if (DynamicEntityImpl.class.isAssignableFrom(entity.getClass())) { super.postConstruct(entity); } }
@Override public int getNumberOfProperties() { return dpm.getPropertyNames().size(); }
public void postConstruct(DynamicEntity entity) { // first step, create 'slots' in propertiesMap createSlots((DynamicEntityImpl)entity); // next step, initialize 'slot' values initializeSlotValues((DynamicEntityImpl)entity); }