org.jsimpledb.parse.util.ParseCastFunction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jsimpledb-parse Show documentation
Show all versions of jsimpledb-parse Show documentation
JSimpleDB classes for parsing Java expressions.
The newest version!
/*
* Copyright (C) 2015 Archie L. Cobbs. All rights reserved.
*/
package org.jsimpledb.parse.util;
import org.jsimpledb.parse.expr.EvalException;
import org.jsimpledb.util.CastFunction;
/**
* Parsing specific subclass of {@link CastFunction} that throws {@link EvalException}s instead of {@link ClassCastException}s.
*/
public class ParseCastFunction extends CastFunction {
public ParseCastFunction(Class type) {
super(type);
}
@Override
protected RuntimeException handleFailure(Object obj, ClassCastException e) {
return new EvalException("can't cast object of type " + obj.getClass().getName() + " to " + this.type.getName());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy