Examples of ScriptRuntimeException


Examples of webit.script.exceptions.ScriptRuntimeException

    public Object get(final Object object, final Object property) {
        try {
            return BeanUtil.get(object, String.valueOf(property));
        } catch (Exception e) {
            throw new ScriptRuntimeException(e.getMessage());
        }
    }
View Full Code Here

Examples of webit.script.exceptions.ScriptRuntimeException

    public void set(final Object object, final Object property, final Object value) {
        try {
            BeanUtil.set(object, String.valueOf(property), value);
        } catch (Exception e) {
            throw new ScriptRuntimeException(e.getMessage());
        }
    }
View Full Code Here

Examples of webit.script.exceptions.ScriptRuntimeException

            return ((Object[]) object).length;
        }
        if ("isEmpty".equals(property)) {
            return ((Object[]) object).length == 0;
        }
        throw new ScriptRuntimeException(StringUtil.concat("Invalid property: array#", property));
    }
View Full Code Here

Examples of webit.script.exceptions.ScriptRuntimeException

        if (property instanceof Number) {
            try {
                ((Object[]) object)[((Number) property).intValue()] = value;
                return;
            } catch (ArrayIndexOutOfBoundsException e) {
                throw new ScriptRuntimeException(StringUtil.concat("Array index out of bounds, index=", (Number) property));
            }
        }
        throw new ScriptRuntimeException(StringUtil.concat("Invalid property: array#", property));
    }
View Full Code Here

Examples of webit.script.exceptions.ScriptRuntimeException

                }
                if (cls == byte[].class) {
                    return ((byte[]) object)[index];
                }
            } catch (ArrayIndexOutOfBoundsException e) {
                throw new ScriptRuntimeException(StringUtil.concat("Array index out of bounds, index=", index));
            }
        }
        if ("length".equals(property) || "size".equals(property)) {
            return ArrayUtil.getSize(object);
        }
        if ("isEmpty".equals(property)) {
            return ArrayUtil.getSize(object) == 0;
        }
        throw new ScriptRuntimeException(StringUtil.concat("Invalid property: array#", property));
    }
View Full Code Here

Examples of webit.script.exceptions.ScriptRuntimeException

                if (cls == byte[].class) {
                    ((byte[]) o1)[index] = ((Number) value).byteValue();
                    return;
                }
            } catch (ArrayIndexOutOfBoundsException e) {
                throw new ScriptRuntimeException(StringUtil.concat("Array index out of bounds, index=", index));
            } catch (ClassCastException e) {
                throw new ScriptRuntimeException(e.getMessage());
            }
        }
        throw new ScriptRuntimeException(StringUtil.concat("Invalid property or can't write: array#", property));
    }
View Full Code Here

Examples of webit.script.exceptions.ScriptRuntimeException

                return args[1];
            }
            if (i == 0) {
                return context.getLocal(args[0]);
            }
            throw new ScriptRuntimeException("This function need at least 1 arg: ");
        }
View Full Code Here

Examples of webit.script.exceptions.ScriptRuntimeException

        }

        public Object invoke(final Context context, final Object[] args) {
            final int len;
            if (args == null || (len = args.length) == 0) {
                throw new ScriptRuntimeException("This method need 1 argument at least.");
            }
            final CachingEntry cachingEntry;
            final Object firstArgument = args[0];
            if (firstArgument instanceof MethodDeclare) {
                cachingEntry = buildIfAbent(context, firstArgument, (MethodDeclare) firstArgument, args, 1);
            } else if (len > 1) {
                final Object secondArgument;
                if ((secondArgument = args[1]) instanceof MethodDeclare) {
                    cachingEntry = buildIfAbent(context, firstArgument, (MethodDeclare) secondArgument, args, 2);
                } else {
                    throw new ScriptRuntimeException("This method need a function argument at index 0 or 1.");
                }
            } else {
                throw new ScriptRuntimeException("This method need a function argument.");
            }
            context.out(cachingEntry.outted);
            return cachingEntry.returned;
        }
View Full Code Here

Examples of webit.script.exceptions.ScriptRuntimeException

* @author zqq90
*/
public class ScriptVoidResolver implements GetResolver, SetResolver, OutResolver {

    public Object get(Object object, Object property) {
        throw new ScriptRuntimeException("'Void' type has no property.");
    }
View Full Code Here

Examples of webit.script.exceptions.ScriptRuntimeException

    public Class getMatchClass() {
        return Void.class;
    }

    public void set(Object object, Object property, Object value) {
        throw new ScriptRuntimeException("'Void' type has no property.");
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.