panda.cast.castor.FileCastor Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of panda-core Show documentation
Show all versions of panda-core Show documentation
Panda Core is the core module of Panda Framework, it contains commonly used utility classes similar to apache-commons.
package panda.cast.castor;
import java.io.File;
import panda.cast.CastContext;
public class FileCastor extends AnySingleCastor {
public FileCastor() {
super(File.class);
}
@Override
protected File castValue(Object value, CastContext context) {
if (value instanceof CharSequence) {
String s = value.toString();
return new File(s);
}
return castError(value, context);
}
}