write value to entityBean field
765644
public static void writeValueToBeanField(Object entityBean, String fieldName, Object value) {
		Method writeMethod = ClassCacheUtils.getClassFieldWriteMethod(entityBean.getClass(), fieldName);
		if (writeMethod == null) {
			throw new DialectException("Can not find Java bean read method '" + fieldName + "'");
		} else
			try {
				writeMethod.invoke(entityBean, value);
			} catch (Exception e) {
				throw new DialectException("FieldName '" + fieldName + "' can not write with value '" + value + "'", e);
			}
	}
493611
private void writeProperties(JsonGenerator jsonGenerator, ResultSet rs) throws IOException, SQLException {
        if (columnCountProperties != -1) {
            jsonGenerator.writeObjectFieldStart("properties");
            for (Map.Entry<String, Integer> entry : cachedColumnNames.entrySet()) {
                String string = entry.getKey();
                string = string.toLowerCase();
                Integer fieldId = entry.getValue();
                if (rs.getObject(fieldId) instanceof Object[]) {
                    Object[] array = (Object[]) rs.getObject(fieldId);
                    jsonGenerator.writeArrayFieldStart(string);
                    writeArray(jsonGenerator, array, true);
                    jsonGenerator.writeEndArray();
                } else if (rs.getObject(fieldId) != null && rs.getObject(fieldId).equals("{}")){
                    jsonGenerator.writeObjectFieldStart(string);
                    jsonGenerator.writeEndObject();
                } else if (rs.getObject(fieldId) == "null") {
                    jsonGenerator.writeFieldName(string);
                    jsonGenerator.writeNull();
                } else {
                    jsonGenerator.writeObjectField(string, rs.getObject(fieldId));
                }
            }
            jsonGenerator.writeEndObject();
        }
    }
272744
public void writeData(Object entity, EntityType entityType) throws XMLStreamException, ODataRenderException {

        xmlWriter.writeStartElement(ODATA_CONTENT);
        xmlWriter.writeAttribute(TYPE, XML.toString());
        xmlWriter.writeStartElement(METADATA, ODATA_PROPERTIES, "");

        marshall(entity, entityType);

        xmlWriter.writeEndElement();
        xmlWriter.writeEndElement();
    }
1046544
public static Serializable getBeanFieldValue(IDeepType entity, Field deepField) {
        try {
            return (Serializable) PropertyUtils.getProperty(entity, deepField.getName());

        } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e1) {
            throw new DeepIOException(e1);
        }

    }
840779
public final void writeBooleanField(String fieldName, boolean value)
        throws IOException, JsonGenerationException
    {
        writeFieldName(fieldName);
        writeBoolean(value);
    }
415325
ByteBuffer getBytesValue(String jpaFieldName, EntityMetadata m, Object value) {
        Attribute idCol = m.getIdAttribute();
        MetamodelImpl metaModel =
            (MetamodelImpl) kunderaMetadata.getApplicationMetadata().getMetamodel(m.getPersistenceUnit());

        EntityType entity = metaModel.entity(m.getEntityClazz());
        Field f = null;
        boolean isId = false;
        if (((AbstractAttribute) idCol).getJPAColumnName().equals(jpaFieldName)) {
            f = (Field) idCol.getJavaMember();
            isId = true;
        } else {
            if (jpaFieldName != null && jpaFieldName.indexOf(Constants.INDEX_TABLE_ROW_KEY_DELIMITER) > 0) {
                String embeddedFieldName =
                    jpaFieldName.substring(0, jpaFieldName.indexOf(Constants.INDEX_TABLE_ROW_KEY_DELIMITER));
                String columnFieldName = jpaFieldName.substring(
                    jpaFieldName.indexOf(Constants.INDEX_TABLE_ROW_KEY_DELIMITER) + 1, jpaFieldName.length());

                Attribute embeddedAttr = entity.getAttribute(embeddedFieldName);
                try {
                    Class<?> embeddedClass = embeddedAttr.getJavaType();
                    if (Collection.class.isAssignableFrom(embeddedClass)) {
                        Class<?> genericClass =
                            PropertyAccessorHelper.getGenericClass((Field) embeddedAttr.getJavaMember());
                        f = genericClass.getDeclaredField(columnFieldName);
                    } else {
                        f = embeddedClass.getDeclaredField(columnFieldName);
                    }

                } catch (SecurityException e) {
                    log.error("Error while extrating " + jpaFieldName + ", Caused by: ", e);
                    throw new QueryHandlerException("Error while extrating " + jpaFieldName + ".");
                } catch (NoSuchFieldException e) {
                    log.error("Error while extrating " + jpaFieldName + ", Caused by: ", e);
                    throw new QueryHandlerException("Error while extrating " + jpaFieldName + ".");
                }
            } else {
                String discriminatorColumn = ((AbstractManagedType) entity).getDiscriminatorColumn();

                if (!jpaFieldName.equals(discriminatorColumn)) {
                    String fieldName = m.getFieldName(jpaFieldName);

                    Attribute col = entity.getAttribute(fieldName);
                    if (col == null) {
                        throw new QueryHandlerException("column type is null for: " + jpaFieldName);
                    }
                    f = (Field) col.getJavaMember();
                }
            }
        }

        // need to do integer.parseInt..as value will be string in case of
        // create query.
        if (f != null && f.getType() != null) {
            return CassandraUtilities.toBytes(value, f);
        } else {
            // default is String type
            return CassandraUtilities.toBytes(value, String.class);
        }
    }
623686
private void writeStringField(String fieldName, Object value) throws IOException
   {
      String val = value.toString();
      if (!val.isEmpty())
      {
         m_writer.writeNameValuePair(fieldName, val);
      }
   }
1147348
def write_record(fo, datum, schema):
    """"""
    for field in schema['fields']:
        name = field['name']
        if name not in datum and 'default' not in field and \
                'null' not in field['type']:
            raise ValueError('no value and no default for %s' % name)
        write_data(fo, datum.get(
            name, field.get('default')), field['type'])
1291918
private void putValue(EsRequest doc, EsIndexColumn column, Object value) {
        Object columnValue = column.columnValue(value);
        String stringValue = column.stringValue(value);
        doc.put(column.getName(), columnValue);
        if (!(value instanceof ModeShapeDateTime || value instanceof Long || value instanceof Boolean)) {
            doc.put(column.getLowerCaseFieldName(), stringValue.toLowerCase());
            doc.put(column.getUpperCaseFieldName(), stringValue.toUpperCase());
        }
        doc.put(column.getLengthFieldName(), stringValue.length());
    }
381504
private Map<String, Object> writeBean(Bean bean, Class<?> declaredType) {
        Map<String, Object> result = new LinkedHashMap<>();
        // property information
        for (MetaProperty<?> prop : bean.metaBean().metaPropertyIterable()) {
            if (prop.style().isSerializable() || (prop.style().isDerived() && settings.isIncludeDerived())) {
                Object value = SerOptional.extractValue(prop, bean);
                if (value != null) {
                    Object outputValue = null;
                    Class<?> propType = SerOptional.extractType(prop, bean.getClass());
                    if (value instanceof Bean) {
                        if (settings.getConverter().isConvertible(value.getClass())) {
                            outputValue = writeSimple(propType, value);
                        } else {
                            outputValue = writeBean((Bean) value, propType);
                        }
                    } else {
                        SerIterator itemIterator = settings.getIteratorFactory().create(value, prop, bean.getClass(), true);
                        if (itemIterator != null) {
                            outputValue = writeElements(itemIterator);
                        } else {
                            outputValue = writeSimple(propType, value);
                        }
                    }
                    result.put(prop.name(), outputValue);
                }
            }
        }
        return result;
    }
659906
protected void doUpdateBeanValue(final Object value) {
		String beanProperty = getBeanProperty();
		if (beanProperty != null && beanProperty.length() > 0 && !".".equals(beanProperty)) {
			Object bean = getBean();
			if (bean != null) {
				try {
					Object beanValue = getBeanValue();
					if (!Util.equals(beanValue, value)) {
						PropertyUtils.setProperty(bean, beanProperty, value);
					}
				} catch (Exception e) {
					LOG.error("Failed to set bean property " + beanProperty + " on " + bean);
				}
			}
		}
	}
878999
@Override
    public void writeColumns(HTableInterface htable, Object rowKey, Map<String, Attribute> columns, Object entity,
            String columnFamilyName) throws IOException
    {
        Put p = new Put(HBaseUtils.getBytes(rowKey));

        boolean present = false;
        for (String columnName : columns.keySet())
        {
            Attribute column = columns.get(columnName);
            if (!column.isCollection() && !((SingularAttribute) column).isId())
            {
                String qualifier = columnName;
                try
                {
                    byte[] qualValInBytes = Bytes.toBytes(qualifier);
                    Object value = PropertyAccessorHelper.getObject(entity, (Field) column.getJavaMember());
                    if (value != null)
                    {
                        p.add(columnFamilyName.getBytes(), qualValInBytes, System.currentTimeMillis(),
                                HBaseUtils.getBytes(value));
                        present = true;
                    }
                }
                catch (PropertyAccessException e1)
                {
                    throw new IOException(e1);
                }
            }
        }
        if (present)
        {
            htable.put(p);
        }
    }
881457
public void write(Object object, Object value) {
        if(object == null) {
            String msg = "Can not update the identifier \"" + _identifier + "\" on a null value object.";
            LOGGER.error(msg);
            throw new RuntimeException(msg);
        }

        if(TRACE_ENABLED)
            LOGGER.trace("Update property named \"" + _identifier + "\" on object of type: \"" + object.getClass().getName() + "\"");

        if(object instanceof Map)
            mapUpdate((Map)object, _identifier, value);
        else if(object instanceof List) {
            int i = parseIndex(_identifier);
            listUpdate((List)object, i, value);
        }
        else if(object.getClass().isArray()) {
            int i = parseIndex(_identifier);
            arrayUpdate(object, i, value);
        }
        else beanUpdate(object, _identifier, value);
    }
1040129
def _write_value(self, field_type, value):
        
        if len(field_type) > 1:
            # We don't need details for arrays and objects
            field_type = field_type[0]

        if field_type == self.TYPE_BOOLEAN:
            self._writeStruct(">B", 1, (1 if value else 0,))
        elif field_type == self.TYPE_BYTE:
            self._writeStruct(">b", 1, (value,))
        elif field_type == self.TYPE_CHAR:
            self._writeStruct(">H", 1, (ord(value),))
        elif field_type == self.TYPE_SHORT:
            self._writeStruct(">h", 1, (value,))
        elif field_type == self.TYPE_INTEGER:
            self._writeStruct(">i", 1, (value,))
        elif field_type == self.TYPE_LONG:
            self._writeStruct(">q", 1, (value,))
        elif field_type == self.TYPE_FLOAT:
            self._writeStruct(">f", 1, (value,))
        elif field_type == self.TYPE_DOUBLE:
            self._writeStruct(">d", 1, (value,))
        elif field_type == self.TYPE_OBJECT or field_type == self.TYPE_ARRAY:
            if value is None:
                self.write_null()
            elif isinstance(value, JavaEnum):
                self.write_enum(value)
            elif isinstance(value, (JavaArray, JavaByteArray)):
                self.write_array(value)
            elif isinstance(value, JavaObject):
                self.write_object(value)
            elif isinstance(value, JavaString):
                self.write_string(value)
            elif isinstance(value, str):
                self.write_blockdata(value)
            else:
                raise RuntimeError("Unknown typecode: {0}".format(field_type))
        else:
            raise RuntimeError("Unknown typecode: {0}".format(field_type))
823771
@SuppressWarnings("unchecked")
    public void writeObjectField(final EnMember member, Object obj) {
        Object value = member.attribute.get(obj);
        if (value == null) return;
        if (tiny()) {
            if (member.istring) {
                if (((CharSequence) value).length() == 0) return;
            } else if (member.isbool) {
                if (!((Boolean) value)) return;
            }
        }
        this.writeFieldName(member);
        member.encoder.convertTo(this, value);
        this.comma = true;
    }
695193
public void serializeBean(Object obj, Set<String> attributesToIgnore) {
        builder.newIndentedline();
        try {
            BeanInfo info = Introspector.getBeanInfo(obj.getClass());
            List<NameValue> values = new ArrayList<>();

            for (PropertyDescriptor pd : info.getPropertyDescriptors()) {
                if (pd.getName().equals("class")) continue;
                Object value = pd.getReadMethod().invoke(obj);
                if (value == null) continue;
                if (value instanceof List && ((List) value).isEmpty()) continue;
                String attribute = getAttributeForField(pd.getName());
                if (!attributesToIgnore.contains(attribute)) {
                    values.add(new NameValue(attribute, value, value instanceof List && isPlainType(((List) value).get(0))));
                }
            }

            for (int i = 0; i < values.size(); i++) {
                NameValue value = values.get(i);
                builder.append(value.name).append(" = ");
                if (value.plain) {
                    serializePlain(value.value);
                } else {
                    serialize(value.value);
                }
                if (i < values.size() - 1) {
                    builder.newline();
                }

            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
        builder.unindent().newline();
    }
1097994
private void writeField(String fieldName, DataType fieldType, Object value) throws IOException
   {
      switch (fieldType)
      {
         case INTEGER:
         {
            writeIntegerField(fieldName, value);
            break;
         }

         case PERCENTAGE:
         case CURRENCY:
         case NUMERIC:
         case UNITS:
         {
            writeDoubleField(fieldName, value);
            break;
         }

         case BOOLEAN:
         {
            writeBooleanField(fieldName, value);
            break;
         }

         case WORK:
         case DURATION:
         {
            writeDurationField(fieldName, value);
            break;
         }

         case DATE:
         {
            writeDateField(fieldName, value);
            break;
         }

         case TIME_UNITS:
         {
            writeTimeUnitsField(fieldName, value);
            break;
         }

         case PRIORITY:
         {
            writePriorityField(fieldName, value);
            break;
         }

         case RELATION_LIST:
         {
            writeRelationList(fieldName, value);
            break;
         }

         case MAP:
         {
            writeMap(fieldName, value);
            break;
         }

         case BINARY:
         {
            // Don't write binary data
            break;
         }

         default:
         {
            writeStringField(fieldName, value);
            break;
         }
      }
   }