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

org.solovyev.common.text.ValueOfFormatter Maven / Gradle / Ivy

There is a newer version: 1.0.7
Show newest version
/*
 * Copyright (c) 2009-2011. Created by serso aka se.solovyev.
 * For more information, please, contact [email protected]
 * or visit http://se.solovyev.org
 */

package org.solovyev.common.text;

import org.jetbrains.annotations.Nullable;

/**
 * User: serso
 * Date: 9/20/11
 * Time: 10:52 PM
 */
public class ValueOfFormatter implements Formatter {

	private final boolean processNulls;

	public ValueOfFormatter() {
		this(false);
	}

	public ValueOfFormatter(boolean processNulls) {
		this.processNulls = processNulls;
	}


	@Override
	public String formatValue(@Nullable T t) throws IllegalArgumentException {
		return t == null ? (processNulls ? String.valueOf(t) : null) : String.valueOf(t);
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy