<commit_before>package org.rapidoid.db.impl;

/*
 * #%L
 * rapidoid-db-impl
 * %%
 * Copyright (C) 2014 - 2015 <NAME>
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */

import java.util.Map;

import org.rapidoid.db.DbColumn;
import org.rapidoid.prop.SerializableBean;
import org.rapidoid.util.U;

public class DbColumnImpl<E> implements DbColumn<E>, SerializableBean<Object> {

	private static final long serialVersionUID = 5047929644817533060L;

	private final Map<String, Object> map;

	private final String name;

	public DbColumnImpl(Map<String, Object> map, String name) {
		U.notNull(map, "map");
		U.notNull(name, "name");

		this.map = map;
		this.name = name;
	}

	@SuppressWarnings("unchecked")
	@Override
	public E get() {
		return (E) map.get(name);
	}

	@Override
	public void set(E value) {
		map.put(name, value);
	}

	@Override
	public Object serializeBean() {
		return get();
	}

	@SuppressWarnings("unchecked")
	@Override
	public void deserializeBean(Object serialized) {
		set((E) serialized);
	}

}<commit_msg>Fixed DB column impl (when setting a null value).<commit_after>package org.rapidoid.db.impl;

/*
 * #%L
 * rapidoid-db-impl
 * %%
 * Copyright (C) 2014 - 2015 <NAME>
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */

import java.util.Map;

import org.rapidoid.db.DbColumn;
import org.rapidoid.prop.SerializableBean;
import org.rapidoid.util.U;

public class DbColumnImpl<E> implements DbColumn<E>, SerializableBean<Object> {

	private static final long serialVersionUID = 5047929644817533060L;

	private final Map<String, Object> map;

	private final String name;

	public DbColumnImpl(Map<String, Object> map, String name) {
		U.notNull(map, "map");
		U.notNull(name, "name");

		this.map = map;
		this.name = name;
	}

	@SuppressWarnings("unchecked")
	@Override
	public E get() {
		return (E) map.get(name);
	}

	@Override
	public void set(E value) {
		if (value != null) {
			map.put(name, value);
		} else {
			map.remove(name);
		}
	}

	@Override
	public Object serializeBean() {
		return get();
	}

	@SuppressWarnings("unchecked")
	@Override
	public void deserializeBean(Object serialized) {
		set((E) serialized);
	}

}
{'fraction_non_alphanumeric': 0.11384903306300687, 'fraction_numerical': 0.01933873986275733, 'mean_word_length': 3.972093023255814, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4628060', 'n_tokens_mistral': 1100, 'n_tokens_neox': 1012, 'n_words': 333}