Package webit.script.exceptions

Examples of webit.script.exceptions.ScriptRuntimeException


    public Object get(Object object, Object property) {
        if (property instanceof Number) {
            try {
                return ((List) object).get(((Number) property).intValue());
            } catch (IndexOutOfBoundsException e) {
                throw new ScriptRuntimeException(StringUtil.concat("index out of bounds:", property));
            }
        }
        if ("size".equals(property)) {
            return ((List) object).size();
        }
        if ("isEmpty".equals(property)) {
            return ((List) object).isEmpty();
        }
        throw new ScriptRuntimeException(StringUtil.concat("Invalid property or can't read: java.util.List#", property));
    }
View Full Code Here


            } else {
                list.set(index, value);
                return;
            }
        }
        throw new ScriptRuntimeException(StringUtil.concat("Invalid property or can't write: java.util.List#", property));
    }
View Full Code Here

    public Object get(final Object object, final Object property) {
        if (property instanceof Number) {
            try {
                return ((CharSequence) object).charAt(((Number) property).intValue());
            } catch (IndexOutOfBoundsException e) {
                throw new ScriptRuntimeException(StringUtil.concat("index out of bounds:", property));
            }
        }
        if ("length".equals(property) || "size".equals(property)) {
            return ((CharSequence) object).length();
        }
        if ("isEmpty".equals(property)) {
            return ((CharSequence) object).length() == 0;
        }
        throw new ScriptRuntimeException(StringUtil.concat("Invalid property or can't read: java.lang.CharSequence#", property));
    }
View Full Code Here

    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

    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

            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

        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

                }
                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

                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

                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

TOP

Related Classes of webit.script.exceptions.ScriptRuntimeException

Copyright © 2018 www.massapicom. 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.