org.solovyev.common.text.NumberMapper Maven / Gradle / Ivy
/*
* 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.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* User: serso
* Date: 9/26/11
* Time: 11:10 PM
*/
public class NumberMapper implements Mapper{
@NotNull
private final Formatter formatter = new ValueOfFormatter();
@NotNull
private final Parser parser;
public NumberMapper(@NotNull Class clazz) {
this.parser = new NumberParser(clazz);
}
@Override
public String formatValue(@Nullable T value) throws IllegalArgumentException {
return formatter.formatValue(value);
}
@Override
public T parseValue(@Nullable String value) throws IllegalArgumentException {
return this.parser.parseValue(value);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy