/** * Sets the value of the field on the object. * * @param object The object. * @param value The new value. * @throws IllegalStateException The Java object has changed and is no longer supported by this * handler, or the handler is not compatiable with the Java object. * @throws IllegalArgumentException The value passed is not of a supported type. */ public final void setValue(Object object, Object value) throws IllegalStateException, IllegalArgumentException { if (_handler == null) { throw new IllegalStateException(NULL_HANDLER_ERR); } _handler.setValue(object, convertUponSet(value)); }
/** * Sets the value of the field on the object. * * @param object The object. * @param value The new value. * @throws IllegalStateException The Java object has changed and is no longer * supported by this handler, or the handler is not compatiable with the * Java object. * @throws IllegalArgumentException The value passed is not of a supported type. */ public final void setValue(Object object, Object value) throws IllegalStateException, IllegalArgumentException { if (_handler == null) { throw new IllegalStateException(NULL_HANDLER_ERR); } _handler.setValue(object, convertUponSet(value)); }
/** * Sets the value of the field associated with this descriptor. * * @param target the object in which to set the value * @param value the value of the field * @throws IllegalStateException if the value provided cannot be parsed into a legal date/time. */ public void setValue(final Object target, final Object value) throws java.lang.IllegalStateException { Date date = null; if (value == null || value instanceof Date) { date = (Date) value; } else { try { date = parse(value.toString(), _options); // -- java.sql.Date? if (_useSQLDate && date != null) { date = new java.sql.Date(date.getTime()); } } catch (java.text.ParseException px) { // -- invalid dateTime throw new IllegalStateException(px.getMessage()); } } _handler.setValue(target, date); } // -- setValue
/** * Sets the value of the field associated with this descriptor. * * @param target the object in which to set the value * @param value the value of the field * @throws IllegalStateException The Java object has changed and is no longer supported by this * handler, or the handler is not compatible with the Java object. */ public void setValue(final Object target, final Object value) throws java.lang.IllegalStateException { Object obj = null; if (value != null) { Object[] args = new String[1]; args[0] = value.toString(); try { obj = _valueOf.invoke(null, args); } catch (java.lang.reflect.InvocationTargetException ite) { Throwable toss = ite.getTargetException(); throw new IllegalStateException(toss.toString()); } catch (java.lang.IllegalAccessException iae) { throw new IllegalStateException(iae.toString()); } } _handler.setValue(target, obj); } // -- setValue
/** * Sets the value of the field associated with this descriptor. * * @param target the object in which to set the value * @param value the value of the field * @throws IllegalStateException The Java object has changed and is no * longer supported by this handler, or the handler is not * compatible with the Java object. */ public void setValue(final Object target, final Object value) throws java.lang.IllegalStateException { Object[] args = new String[1]; Object obj = null; if (value != null) { args[0] = value.toString(); try { obj = _valueOf.invoke(null, args); } catch (java.lang.reflect.InvocationTargetException ite) { Throwable toss = ite.getTargetException(); throw new IllegalStateException(toss.toString()); } catch (java.lang.IllegalAccessException iae) { throw new IllegalStateException(iae.toString()); } } _handler.setValue(target, obj); } //-- setValue
/** * Sets the value of the field on the object. That is, sets the value of the container parent to * the provided value. * * @param object The object whose value to set. * @param value The new value * @throws IllegalStateException The Java object has changed and is no longer supported by this * handler, or the handler is not compatiable with the Java object * @throws IllegalArgumentException The value passed is not of a supported type */ public void setValue(final Object object, final Object value) throws IllegalStateException, IllegalArgumentException { if (_mode == MODE_PARENT_LINK) { // Do nothing for MODE_PARENT_LINK; the container is not part of the object model return; } // For MODE_AUTO and MODE_CHILD_LINK: if (object instanceof ContainerElement) { _handler.setValue(((ContainerElement) object).getParent(), value); } } // -- setValue
/** * Sets the value of the field on the object. That is, sets the value of the * container parent to the provided value. * * @param object The object whose value to set. * @param value The new value * @throws IllegalStateException The Java object has changed and is no * longer supported by this handler, or the handler is not * compatiable with the Java object * @throws IllegalArgumentException The value passed is not of a supported * type */ public void setValue(final Object object, final Object value) throws IllegalStateException, IllegalArgumentException { if (_mode == MODE_PARENT_LINK) { // Do nothing for MODE_PARENT_LINK; the container is not part of the object model return; } // For MODE_AUTO and MODE_CHILD_LINK: if (object instanceof ContainerElement) { _handler.setValue(((ContainerElement) object).getParent(), value); } } //-- setValue
/** * Sets the value of the field associated with this descriptor. * * @param target the object in which to set the value * @param value the value of the field * @throws IllegalStateException if the value provided cannot be parsed into * a legal date/time. */ public void setValue(final Object target, final Object value) throws java.lang.IllegalStateException { Date date = null; if (value == null || value instanceof Date) { date = (Date) value; } else { try { date = parse(value.toString(), _options); // -- java.sql.Date? if (_useSQLDate && date != null) { date = new java.sql.Date(date.getTime()); } } catch (java.text.ParseException px) { // -- invalid dateTime throw new IllegalStateException(px.getMessage()); } } _handler.setValue(target, date); } // -- setValue
/** * Saves local namespace declarations to the object model if necessary. * * @param classDesc the current ClassDescriptor. * @param object the Object of the current state **/ public void processNamespaces(XMLClassDescriptor classDesc, Object object) { if (classDesc == null) { return; } // -- process namespace nodes XMLFieldDescriptor nsDescriptor = classDesc.getFieldDescriptor(null, null, NodeType.Namespace); if (nsDescriptor != null) { FieldHandler handler = nsDescriptor.getHandler(); if (handler != null) { Enumeration<String> enumeration = namespacesStack.getLocalNamespacePrefixes(); while (enumeration.hasMoreElements()) { String nsPrefix = StringUtils.defaultString(enumeration.nextElement()); String nsURI = StringUtils.defaultString(namespacesStack.getNamespaceURI(nsPrefix)); MapItem mapItem = new MapItem(nsPrefix, nsURI); handler.setValue(object, mapItem); } } } }
/** * Saves local namespace declarations to the object * model if necessary. * * @param classDesc the current ClassDescriptor. **/ private void processNamespaces(XMLClassDescriptor classDesc) { if (classDesc == null) return; //-- process namespace nodes XMLFieldDescriptor nsDescriptor = classDesc.getFieldDescriptor(null, null, NodeType.Namespace); if (nsDescriptor != null) { UnmarshalState state = (UnmarshalState) _stateInfo.peek(); FieldHandler handler = nsDescriptor.getHandler(); if (handler != null) { Enumeration enumeration = _namespaces.getLocalNamespacePrefixes(); while (enumeration.hasMoreElements()) { String nsPrefix = (String)enumeration.nextElement(); if (nsPrefix == null) nsPrefix = ""; String nsURI = _namespaces.getNamespaceURI(nsPrefix); if (nsURI == null) nsURI = ""; MapItem mapItem = new MapItem(nsPrefix, nsURI); handler.setValue(state.object, mapItem); } } } } //-- processNamespaces
/** * Processes the given IDREF * * @param idRef the ID of the object in which to reference * @param descriptor the current FieldDescriptor * @param parent the current parent object * @return true if the ID was found and resolved properly */ private boolean processIDREF (String idRef, XMLFieldDescriptor descriptor, Object parent) { Object value = _idResolver.resolve(idRef); if (value == null) { //-- save state to resolve later addReference(idRef, parent, descriptor); } else { FieldHandler handler = descriptor.getHandler(); if (handler != null) handler.setValue(parent, value); } return (value != null); } //-- processIDREF
/** * Processes the given IDREF. * * @param idRef the ID of the object in which to reference * @param descriptor the current FieldDescriptor * @param parent the current parent object * @return true if the ID was found and resolved properly */ boolean processIDREF(final String idRef, final XMLFieldDescriptor descriptor, final Object parent) { Object value = _idResolver.resolve(idRef); if (value == null) { // -- save state to resolve later addReference(idRef, parent, descriptor); } else { FieldHandler handler = descriptor.getHandler(); if (handler != null) { handler.setValue(parent, value); } } return (value != null); }
FieldHandler handler = refInfo.getDescriptor().getHandler(); if (handler != null) { handler.setValue(refInfo.getTarget(), value);
handler.setValue(parent, value);
FieldHandler handler = refInfo.getDescriptor().getHandler(); if (handler != null) handler.setValue(refInfo.getTarget(), value);
handler.setValue(parent, value);
FieldHandler fieldHandler = versionFieldDescriptor.getHandler(); fieldHandler.setValue(proposedObject.getEntity(), locker.getVersion());
jdoNature.getField(versionField); FieldHandler fieldHandler = versionFieldDescriptor.getHandler(); fieldHandler.setValue(object, timeStamp);