Java Code Examples for jdk.nashorn.internal.runtime.ScriptObject#keySet()

The following examples show how to use jdk.nashorn.internal.runtime.ScriptObject#keySet() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: LinkerCallSite.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
private void printObject(final PrintWriter out, final Object arg) {
    if (!getNashornDescriptor().isTraceObjects()) {
        out.print((arg instanceof ScriptObject) ? "ScriptObject" : arg);
        return;
    }

    if (arg instanceof ScriptObject) {
        final ScriptObject object = (ScriptObject)arg;

        boolean isFirst = true;
        final Set<Object> keySet = object.keySet();

        if (keySet.isEmpty()) {
            out.print(ScriptRuntime.safeToString(arg));
        } else {
            out.print("{ ");

            for (final Object key : keySet) {
                if (!isFirst) {
                    out.print(", ");
                }

                out.print(key);
                out.print(":");

                final Object value = object.get(key);

                if (value instanceof ScriptObject) {
                    out.print("...");
                } else {
                    printObject(out, value);
                }

                isFirst = false;
            }

            out.print(" }");
        }
     } else {
        out.print(ScriptRuntime.safeToString(arg));
    }
}
 
Example 2
Source File: LinkerCallSite.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
private void printObject(final PrintWriter out, final Object arg) {
    if (!getNashornDescriptor().isTraceObjects()) {
        out.print((arg instanceof ScriptObject) ? "ScriptObject" : arg);
        return;
    }

    if (arg instanceof ScriptObject) {
        final ScriptObject object = (ScriptObject)arg;

        boolean isFirst = true;
        final Set<Object> keySet = object.keySet();

        if (keySet.isEmpty()) {
            out.print(ScriptRuntime.safeToString(arg));
        } else {
            out.print("{ ");

            for (final Object key : keySet) {
                if (!isFirst) {
                    out.print(", ");
                }

                out.print(key);
                out.print(":");

                final Object value = object.get(key);

                if (value instanceof ScriptObject) {
                    out.print("...");
                } else {
                    printObject(out, value);
                }

                isFirst = false;
            }

            out.print(" }");
        }
     } else {
        out.print(ScriptRuntime.safeToString(arg));
    }
}
 
Example 3
Source File: LinkerCallSite.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
private void printObject(final PrintWriter out, final Object arg) {
    if (!getNashornDescriptor().isTraceObjects()) {
        out.print((arg instanceof ScriptObject) ? "ScriptObject" : arg);
        return;
    }

    if (arg instanceof ScriptObject) {
        final ScriptObject object = (ScriptObject)arg;

        boolean isFirst = true;
        final Set<Object> keySet = object.keySet();

        if (keySet.isEmpty()) {
            out.print(ScriptRuntime.safeToString(arg));
        } else {
            out.print("{ ");

            for (final Object key : keySet) {
                if (!isFirst) {
                    out.print(", ");
                }

                out.print(key);
                out.print(":");

                final Object value = object.get(key);

                if (value instanceof ScriptObject) {
                    out.print("...");
                } else {
                    printObject(out, value);
                }

                isFirst = false;
            }

            out.print(" }");
        }
     } else {
        out.print(ScriptRuntime.safeToString(arg));
    }
}
 
Example 4
Source File: LinkerCallSite.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
private void printObject(final PrintWriter out, final Object arg) {
    if (!getNashornDescriptor().isTraceObjects()) {
        out.print((arg instanceof ScriptObject) ? "ScriptObject" : arg);
        return;
    }

    if (arg instanceof ScriptObject) {
        final ScriptObject object = (ScriptObject)arg;

        boolean isFirst = true;
        final Set<Object> keySet = object.keySet();

        if (keySet.isEmpty()) {
            out.print(ScriptRuntime.safeToString(arg));
        } else {
            out.print("{ ");

            for (final Object key : keySet) {
                if (!isFirst) {
                    out.print(", ");
                }

                out.print(key);
                out.print(":");

                final Object value = object.get(key);

                if (value instanceof ScriptObject) {
                    out.print("...");
                } else {
                    printObject(out, value);
                }

                isFirst = false;
            }

            out.print(" }");
        }
     } else {
        out.print(ScriptRuntime.safeToString(arg));
    }
}
 
Example 5
Source File: LinkerCallSite.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
private void printObject(final PrintWriter out, final Object arg) {
    if (!getNashornDescriptor().isTraceObjects()) {
        out.print((arg instanceof ScriptObject) ? "ScriptObject" : arg);
        return;
    }

    if (arg instanceof ScriptObject) {
        final ScriptObject object = (ScriptObject)arg;

        boolean isFirst = true;
        final Set<Object> keySet = object.keySet();

        if (keySet.isEmpty()) {
            out.print(ScriptRuntime.safeToString(arg));
        } else {
            out.print("{ ");

            for (final Object key : keySet) {
                if (!isFirst) {
                    out.print(", ");
                }

                out.print(key);
                out.print(":");

                final Object value = object.get(key);

                if (value instanceof ScriptObject) {
                    out.print("...");
                } else {
                    printObject(out, value);
                }

                isFirst = false;
            }

            out.print(" }");
        }
     } else {
        out.print(ScriptRuntime.safeToString(arg));
    }
}
 
Example 6
Source File: LinkerCallSite.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
private void printObject(final PrintWriter out, final Object arg) {
    if (!getNashornDescriptor().isTraceObjects()) {
        out.print((arg instanceof ScriptObject) ? "ScriptObject" : arg);
        return;
    }

    if (arg instanceof ScriptObject) {
        final ScriptObject object = (ScriptObject)arg;

        boolean isFirst = true;
        final Set<Object> keySet = object.keySet();

        if (keySet.isEmpty()) {
            out.print(ScriptRuntime.safeToString(arg));
        } else {
            out.print("{ ");

            for (final Object key : keySet) {
                if (!isFirst) {
                    out.print(", ");
                }

                out.print(key);
                out.print(":");

                final Object value = object.get(key);

                if (value instanceof ScriptObject) {
                    out.print("...");
                } else {
                    printObject(out, value);
                }

                isFirst = false;
            }

            out.print(" }");
        }
     } else {
        out.print(ScriptRuntime.safeToString(arg));
    }
}
 
Example 7
Source File: LinkerCallSite.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
private void printObject(final PrintWriter out, final Object arg) {
    if (!getNashornDescriptor().isTraceObjects()) {
        out.print((arg instanceof ScriptObject) ? "ScriptObject" : arg);
        return;
    }

    if (arg instanceof ScriptObject) {
        final ScriptObject object = (ScriptObject)arg;

        boolean isFirst = true;
        final Set<Object> keySet = object.keySet();

        if (keySet.isEmpty()) {
            out.print(ScriptRuntime.safeToString(arg));
        } else {
            out.print("{ ");

            for (final Object key : keySet) {
                if (!isFirst) {
                    out.print(", ");
                }

                out.print(key);
                out.print(":");

                final Object value = object.get(key);

                if (value instanceof ScriptObject) {
                    out.print("...");
                } else {
                    printObject(out, value);
                }

                isFirst = false;
            }

            out.print(" }");
        }
     } else {
        out.print(ScriptRuntime.safeToString(arg));
    }
}
 
Example 8
Source File: LinkerCallSite.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
private void printObject(final PrintWriter out, final Object arg) {
    if (!getNashornDescriptor().isTraceObjects()) {
        out.print((arg instanceof ScriptObject) ? "ScriptObject" : arg);
        return;
    }

    if (arg instanceof ScriptObject) {
        final ScriptObject object = (ScriptObject)arg;

        boolean isFirst = true;
        final Set<Object> keySet = object.keySet();

        if (keySet.isEmpty()) {
            out.print(ScriptRuntime.safeToString(arg));
        } else {
            out.print("{ ");

            for (final Object key : keySet) {
                if (!isFirst) {
                    out.print(", ");
                }

                out.print(key);
                out.print(":");

                final Object value = object.get(key);

                if (value instanceof ScriptObject) {
                    out.print("...");
                } else {
                    printObject(out, value);
                }

                isFirst = false;
            }

            out.print(" }");
        }
     } else {
        out.print(ScriptRuntime.safeToString(arg));
    }
}
 
Example 9
Source File: LinkerCallSite.java    From jdk8u_nashorn with GNU General Public License v2.0 4 votes vote down vote up
private void printObject(final PrintWriter out, final Object arg) {
    if (!getNashornDescriptor().isTraceObjects()) {
        out.print((arg instanceof ScriptObject) ? "ScriptObject" : arg);
        return;
    }

    if (arg instanceof ScriptObject) {
        final ScriptObject object = (ScriptObject)arg;

        boolean isFirst = true;
        final Set<Object> keySet = object.keySet();

        if (keySet.isEmpty()) {
            out.print(ScriptRuntime.safeToString(arg));
        } else {
            out.print("{ ");

            for (final Object key : keySet) {
                if (!isFirst) {
                    out.print(", ");
                }

                out.print(key);
                out.print(":");

                final Object value = object.get(key);

                if (value instanceof ScriptObject) {
                    out.print("...");
                } else {
                    printObject(out, value);
                }

                isFirst = false;
            }

            out.print(" }");
        }
     } else {
        out.print(ScriptRuntime.safeToString(arg));
    }
}
 
Example 10
Source File: LinkerCallSite.java    From nashorn with GNU General Public License v2.0 4 votes vote down vote up
private void printObject(final PrintWriter out, final Object arg) {
    if (!getNashornDescriptor().isTraceObjects()) {
        out.print((arg instanceof ScriptObject) ? "ScriptObject" : arg);
        return;
    }

    if (arg instanceof ScriptObject) {
        final ScriptObject object = (ScriptObject)arg;

        boolean isFirst = true;
        final Set<Object> keySet = object.keySet();

        if (keySet.isEmpty()) {
            out.print(ScriptRuntime.safeToString(arg));
        } else {
            out.print("{ ");

            for (final Object key : keySet) {
                if (!isFirst) {
                    out.print(", ");
                }

                out.print(key);
                out.print(":");

                final Object value = object.get(key);

                if (value instanceof ScriptObject) {
                    out.print("...");
                } else {
                    printObject(out, value);
                }

                isFirst = false;
            }

            out.print(" }");
        }
     } else {
        out.print(ScriptRuntime.safeToString(arg));
    }
}