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

org.pac4j.oauth.profile.vk.converter.VkBooleanConverter Maven / Gradle / Ivy

There is a newer version: 6.1.0
Show newest version
package org.pac4j.oauth.profile.vk.converter;

import org.pac4j.core.profile.converter.AttributeConverter;

/**
 * @author indvdum (gotoindvdum[at]gmail[dot]com)
 * @since 1.5
 * 
 */
public final class VkBooleanConverter implements AttributeConverter {

	@Override
	public Boolean convert(final Object attribute) {
		if (attribute != null) {
			if (attribute instanceof Boolean) {
				return (Boolean) attribute;
			} else if (attribute instanceof String) {
				return "1".equals(attribute);
			} else if (attribute instanceof Number) {
				return Integer.valueOf(1).equals(attribute);
			}
		}
		return null;
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy