com.github.akurilov.commons.io.el.SynchronousExpressionInputImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-commons Show documentation
Show all versions of java-commons Show documentation
Common functionality Java library
The newest version!
package com.github.akurilov.commons.io.el;
import de.odysseus.el.util.SimpleContext;
import javax.el.ELException;
import javax.el.PropertyNotFoundException;
import java.util.List;
public class SynchronousExpressionInputImpl
extends ExpressionInputImpl
implements SynchronousExpressionInput {
public SynchronousExpressionInputImpl(
final String exprStr, final T initial, final SimpleContext ctx
) {
super(exprStr, initial, ctx);
}
@Override
public final T get()
throws PropertyNotFoundException, ELException {
try {
return call();
} catch(final Throwable t) {
t.printStackTrace(System.err);
}
return null;
}
@Override
public final int get(final List buffer, final int limit)
throws PropertyNotFoundException, ELException {
for(var i = 0; i < limit; i ++) {
buffer.add(call());
}
return limit;
}
@Override
public final long skip(final long count)
throws PropertyNotFoundException, ELException {
for(var i = 0L; i < count; i ++) {
call();
}
return count;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy