jdk.nashorn.api.scripting.ScriptUtils Java Examples

The following examples show how to use jdk.nashorn.api.scripting.ScriptUtils. 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: EventManager.java    From HeavenMS with GNU Affero General Public License v3.0 6 votes vote down vote up
public List<MaplePartyCharacter> getEligibleParty(MapleParty party) {
    if (party == null) {
        return(new ArrayList<>());
    }
    try {
        Object p = iv.invokeFunction("getEligibleParty", party.getPartyMembersOnline());
        
        if(p != null) {
            List<MaplePartyCharacter> lmpc;
            
            if(ServerConstants.JAVA_8) {
                lmpc = new ArrayList<>(((Map<String, MaplePartyCharacter>)(ScriptUtils.convert(p, Map.class))).values());
            } else {
                lmpc = new ArrayList<>((List<MaplePartyCharacter>) p);
            }

            party.setEligibleMembers(lmpc);
            return lmpc;
        }
    } catch (ScriptException | NoSuchMethodException ex) {
        ex.printStackTrace();
    }

    return(new ArrayList<>());
}
 
Example #2
Source File: NashornBeansLinker.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
static Object exportArgument(final Object arg, final boolean mirrorAlways) {
    if (arg instanceof ConsString) {
        return arg.toString();
    } else if (mirrorAlways && arg instanceof ScriptObject) {
        return ScriptUtils.wrap((ScriptObject)arg);
    } else {
        return arg;
    }
}
 
Example #3
Source File: NashornBeansLinker.java    From jdk8u_nashorn with GNU General Public License v2.0 5 votes vote down vote up
static Object exportArgument(final Object arg, final boolean mirrorAlways) {
    if (arg instanceof ConsString) {
        return arg.toString();
    } else if (mirrorAlways && arg instanceof ScriptObject) {
        return ScriptUtils.wrap((ScriptObject)arg);
    } else {
        return arg;
    }
}
 
Example #4
Source File: NashornBeansLinker.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
static Object exportArgument(final Object arg, final boolean mirrorAlways) {
    if (arg instanceof ConsString) {
        return arg.toString();
    } else if (mirrorAlways && arg instanceof ScriptObject) {
        return ScriptUtils.wrap((ScriptObject)arg);
    } else {
        return arg;
    }
}
 
Example #5
Source File: NashornBeansLinker.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
static Object exportArgument(final Object arg, final boolean mirrorAlways) {
    if (arg instanceof ConsString) {
        return arg.toString();
    } else if (mirrorAlways && arg instanceof ScriptObject) {
        return ScriptUtils.wrap(arg);
    } else {
        return arg;
    }
}
 
Example #6
Source File: NashornBeansLinker.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
static Object exportArgument(final Object arg, final boolean mirrorAlways) {
    if (arg instanceof ConsString) {
        return arg.toString();
    } else if (mirrorAlways && arg instanceof ScriptObject) {
        return ScriptUtils.wrap((ScriptObject)arg);
    } else {
        return arg;
    }
}
 
Example #7
Source File: NashornBeansLinker.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
static Object exportArgument(final Object arg, final boolean mirrorAlways) {
    if (arg instanceof ConsString) {
        return arg.toString();
    } else if (mirrorAlways && arg instanceof ScriptObject) {
        return ScriptUtils.wrap((ScriptObject)arg);
    } else {
        return arg;
    }
}
 
Example #8
Source File: NashornBeansLinker.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
static Object exportArgument(final Object arg, final boolean mirrorAlways) {
    if (arg instanceof ConsString) {
        return arg.toString();
    } else if (mirrorAlways && arg instanceof ScriptObject) {
        return ScriptUtils.wrap((ScriptObject)arg);
    } else {
        return arg;
    }
}
 
Example #9
Source File: NashornLinker.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("unused")
private static Object createMirror(final Object obj) {
    return obj instanceof ScriptObject? ScriptUtils.wrap((ScriptObject)obj) : obj;
}
 
Example #10
Source File: NashornLinker.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("unused")
private static Object createMirror(final Object obj) {
    return obj instanceof ScriptObject? ScriptUtils.wrap((ScriptObject)obj) : obj;
}
 
Example #11
Source File: NashornBeansLinker.java    From jdk8u_nashorn with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("unused")
private static Object importResult(final Object arg) {
    return ScriptUtils.unwrap(arg);
}
 
Example #12
Source File: NashornBeansLinker.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("unused")
private static Object importResult(final Object arg) {
    return ScriptUtils.unwrap(arg);
}
 
Example #13
Source File: NashornLinker.java    From jdk8u_nashorn with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("unused")
private static Object createMirror(final Object obj) {
    return obj instanceof ScriptObject? ScriptUtils.wrap((ScriptObject)obj) : obj;
}
 
Example #14
Source File: NashornLinker.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("unused")
private static Object createMirror(final Object obj) {
    return ScriptUtils.wrap(obj);
}
 
Example #15
Source File: NashornLinker.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("unused")
private static Object createMirror(final Object obj) {
    return ScriptUtils.wrap(obj);
}
 
Example #16
Source File: NashornBeansLinker.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("unused")
private static Object importResult(final Object arg) {
    return ScriptUtils.unwrap(arg);
}
 
Example #17
Source File: NashornLinker.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("unused")
private static Object createMirror(final Object obj) {
    return obj instanceof ScriptObject? ScriptUtils.wrap((ScriptObject)obj) : obj;
}
 
Example #18
Source File: NashornLinker.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("unused")
private static Object createMirror(final Object obj) {
    return obj instanceof ScriptObject? ScriptUtils.wrap((ScriptObject)obj) : obj;
}
 
Example #19
Source File: NashornBeansLinker.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("unused")
private static Object importResult(final Object arg) {
    return ScriptUtils.unwrap(arg);
}
 
Example #20
Source File: NashornLinker.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("unused")
private static Object createMirror(final Object obj) {
    return obj instanceof ScriptObject? ScriptUtils.wrap((ScriptObject)obj) : obj;
}
 
Example #21
Source File: NashornBeansLinker.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("unused")
private static Object importResult(final Object arg) {
    return ScriptUtils.unwrap(arg);
}
 
Example #22
Source File: NashornBeansLinker.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("unused")
private static Object importResult(final Object arg) {
    return ScriptUtils.unwrap(arg);
}
 
Example #23
Source File: NashornLinker.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("unused")
private static Object createMirror(final Object obj) {
    return obj instanceof ScriptObject? ScriptUtils.wrap((ScriptObject)obj) : obj;
}
 
Example #24
Source File: NashornBeansLinker.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
@SuppressWarnings("unused")
private static Object importResult(final Object arg) {
    return ScriptUtils.unwrap(arg);
}