All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.jchanghong.core.convert.impl.AtomicBooleanConverter Maven / Gradle / Ivy

The newest version!
package com.jchanghong.core.convert.impl;

import java.util.concurrent.atomic.AtomicBoolean;

import com.jchanghong.core.convert.AbstractConverter;
import com.jchanghong.core.util.BooleanUtil;

/**
 * {@link AtomicBoolean}转换器
 * 
 * @author Looly
 * @since 3.0.8
 */
public class AtomicBooleanConverter extends AbstractConverter {
	private static final long serialVersionUID = 1L;

	@Override
	protected AtomicBoolean convertInternal(Object value) {
		if (boolean.class == value.getClass()) {
			return new AtomicBoolean((boolean) value);
		}
		if (value instanceof Boolean) {
			return new AtomicBoolean((Boolean) value);
		}
		final String valueStr = convertToStr(value);
		return new AtomicBoolean(BooleanUtil.toBoolean(valueStr));
	}

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy