public Class getAttributeClass() { return oxmAccessor.getAttributeClass(); }
public void setAttributeValueInObject(Object object, Object value) { if(isChangeTracking) { Object oldValue = getAttributeValueFromObject(object); PropertyChangeListener listener = ((ChangeTracker)object)._persistence_getPropertyChangeListener(); if(listener != null) { listener.propertyChange(new PropertyChangeEvent(object, oxmAccessor.getAttributeName(), value, oldValue)); } } if(isValueHolderProperty) { ValueHolderInterface vh = (ValueHolderInterface)ormAccessor.getAttributeValueFromObject(object); if(vh == null) { vh = new ValueHolder(); ((ValueHolder)vh).setIsNewlyWeavedValueHolder(true); } vh.setValue(value); ormAccessor.setAttributeValueInObject(object, vh); } oxmAccessor.setAttributeValueInObject(object, value); }
public void initialize(AbstractSession session) throws DescriptorException { super.initialize(session); if(variableAttributeAccessor == null){ if(variableAttributeName != null){ this.variableAttributeAccessor = new InstanceVariableAttributeAccessor(); this.variableAttributeAccessor.setAttributeName(variableAttributeName); }else if(variableGetMethodName != null){ this.variableAttributeAccessor = new MethodAttributeAccessor(); this.variableAttributeAccessor.setAttributeName("VARIABLE"); ((MethodAttributeAccessor)this.variableAttributeAccessor).setGetMethodName(variableGetMethodName); if(variableSetMethodName == null){ this.variableAttributeAccessor.setIsWriteOnly(true); }else{ ((MethodAttributeAccessor)this.variableAttributeAccessor).setSetMethodName(variableSetMethodName); } } } this.variableAttributeAccessor.initializeAttributes(this.getReferenceClass()); }
/** * ADVANCED: * Set the attributeAccessor. * The attribute accessor is responsible for setting and retrieving the attribute value * from the object for this mapping. * This can be set to an implementor of AttributeAccessor if the attribute * requires advanced conversion of the mapping value, or a real attribute does not exist. */ public void setAttributeAccessor(AttributeAccessor attributeAccessor) { String attributeName = getAttributeName(); this.attributeAccessor = attributeAccessor; if (attributeAccessor.getAttributeName() == null) { attributeAccessor.setAttributeName(attributeName); } this.attributeName = null; }
public Object getAttributeValueFromObject(Object object) { if(isValueHolderProperty) { ValueHolderInterface vh = (ValueHolderInterface)ormAccessor.getAttributeValueFromObject(object); if(vh != null && !vh.isInstantiated()) { Object value = vh.getValue(); oxmAccessor.setAttributeValueInObject(object, value); if(vh instanceof WeavedAttributeValueHolderInterface) { ((WeavedAttributeValueHolderInterface)vh).setIsCoordinatedWithProperty(true); } } } return oxmAccessor.getAttributeValueFromObject(object); }
public void preInitialize(AbstractSession session) throws DescriptorException { getAttributeAccessor().setIsWriteOnly(this.isWriteOnly()); getAttributeAccessor().setIsReadOnly(this.isReadOnly()); super.preInitialize(session); }
/** * PUBLIC: * Set the methodName used to set the value for the mapping's attribute into the object. */ public void setSetMethodName(String methodName) { if (methodName == null) { return; } // This is done because setting attribute name by defaults create InstanceVariableAttributeAccessor if (!getAttributeAccessor().isMethodAttributeAccessor()) { String attributeName = this.attributeAccessor.getAttributeName(); setAttributeAccessor(new MethodAttributeAccessor()); getAttributeAccessor().setAttributeName(attributeName); } ((MethodAttributeAccessor)getAttributeAccessor()).setSetMethodName(methodName); }
/** * INTERNAL: * Return the value of an attribute which this mapping represents for an object. */ public Object getAttributeValueFromObject(Object object) throws DescriptorException { try { // PERF: direct-access. return this.attributeAccessor.getAttributeValueFromObject(object); } catch (DescriptorException exception) { exception.setMapping(this); throw exception; } }
public String getAttributeName() { return oxmAccessor.getAttributeName(); } }
/** * INTERNAL: * Set the value of the attribute mapped by this mapping. */ public void setAttributeValueInObject(Object object, Object value) throws DescriptorException { // PERF: Direct variable access. try { this.attributeAccessor.setAttributeValueInObject(object, value); } catch (DescriptorException exception) { exception.setMapping(this); throw exception; } }
/** * PUBLIC: * Return if method access is used. */ public boolean isUsingMethodAccess() { return getAttributeAccessor().isMethodAttributeAccessor(); }
/** * INTERNAL: * Once descriptors are serialized to the remote session. All its mappings and reference descriptors are traversed. Usually * mappings are initilaized and serialized reference descriptors are replaced with local descriptors if they already exist on the * remote session. */ public void remoteInitialization(DistributedSession session) { // Remote mappings is initilaized here again because while serializing only the uninitialized data is passed // as the initialized data is not serializable. if (!isRemotelyInitialized()) { getAttributeAccessor().initializeAttributes(getDescriptor().getJavaClass()); remotelyInitialized(); } }
/** * PUBLIC: * Sets the name of the attribute in the mapping. */ @Override public void setAttributeName(String attributeName) { getAttributeAccessor().setAttributeName(attributeName); // Clear the mapping attribute name until a getAttributeName() call copies the accessor attributeName this.attributeName = null; }
/** * INTERNAL: * Clones itself. */ public Object clone() { // Bug 3037701 - clone the AttributeAccessor DatabaseMapping mapping = null; try { mapping = (DatabaseMapping)super.clone(); } catch (CloneNotSupportedException e) { throw new InternalError(); } mapping.setAttributeAccessor((AttributeAccessor)attributeAccessor.clone()); return mapping; }
public void preInitialize(AbstractSession session) throws DescriptorException { getAttributeAccessor().setIsWriteOnly(this.isWriteOnly()); getAttributeAccessor().setIsReadOnly(this.isReadOnly()); super.preInitialize(session); }
/** * PUBLIC: * Set the methodName used to set the value for the mapping's attribute into the object. */ public void setSetMethodName(String methodName) { if (methodName == null) { return; } // This is done because setting attribute name by defaults create InstanceVariableAttributeAccessor if (!getAttributeAccessor().isMethodAttributeAccessor()) { String attributeName = this.attributeAccessor.getAttributeName(); setAttributeAccessor(new MethodAttributeAccessor()); getAttributeAccessor().setAttributeName(attributeName); } ((MethodAttributeAccessor)getAttributeAccessor()).setSetMethodName(methodName); }
public void setAttributeValueInObject(Object object, Object value) { if(isChangeTracking) { Object oldValue = getAttributeValueFromObject(object); PropertyChangeListener listener = ((ChangeTracker)object)._persistence_getPropertyChangeListener(); if(listener != null) { listener.propertyChange(new PropertyChangeEvent(object, oxmAccessor.getAttributeName(), value, oldValue)); } } if(isValueHolderProperty) { ValueHolderInterface vh = (ValueHolderInterface)ormAccessor.getAttributeValueFromObject(object); if(vh == null) { vh = new ValueHolder(); ((ValueHolder)vh).setIsNewlyWeavedValueHolder(true); } vh.setValue(value); ormAccessor.setAttributeValueInObject(object, vh); } oxmAccessor.setAttributeValueInObject(object, value); }
/** * INTERNAL: * Return the value of an attribute which this mapping represents for an object. */ @Override public Object getAttributeValueFromObject(Object object) throws DescriptorException { try { // PERF: direct-access. return this.attributeAccessor.getAttributeValueFromObject(object); } catch (DescriptorException exception) { exception.setMapping(this); throw exception; } }
/** * Gets the name of the backpointer attribute on the target object. Used to * populate the backpointer. */ public String getBidirectionalTargetAttributeName() { if(this.bidirectionalTargetAccessor == null) { return null; } return this.getBidirectionalTargetAccessor().getAttributeName(); }
/** * ADVANCED: * Set the attributeAccessor. * The attribute accessor is responsible for setting and retrieving the attribute value * from the object for this mapping. * This can be set to an implementor of AttributeAccessor if the attribute * requires advanced conversion of the mapping value, or a real attribute does not exist. */ @Override public void setAttributeAccessor(AttributeAccessor attributeAccessor) { String attributeName = getAttributeName(); this.attributeAccessor = attributeAccessor; if (attributeAccessor.getAttributeName() == null) { attributeAccessor.setAttributeName(attributeName); } this.attributeName = null; }