Java Code Examples for jdk.nashorn.api.scripting.ScriptUtils

The following examples show how to use jdk.nashorn.api.scripting.ScriptUtils. These examples are extracted from open source projects. 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 Project: HeavenMS   Author: ronancpl   File: EventManager.java    License: 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 Project: TencentKona-8   Author: Tencent   File: NashornBeansLinker.java    License: 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 Project: jdk8u60   Author: chenghanpeng   File: NashornBeansLinker.java    License: 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 Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: NashornBeansLinker.java    License: 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 Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: NashornBeansLinker.java    License: 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 #6
Source Project: openjdk-jdk9   Author: AdoptOpenJDK   File: NashornBeansLinker.java    License: 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 #7
Source Project: hottub   Author: dsrg-uoft   File: NashornBeansLinker.java    License: 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 Project: jdk8u_nashorn   Author: JetBrains   File: NashornBeansLinker.java    License: 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 Project: TencentKona-8   Author: Tencent   File: NashornLinker.java    License: 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 Project: TencentKona-8   Author: Tencent   File: NashornBeansLinker.java    License: 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 #11
Source Project: jdk8u60   Author: chenghanpeng   File: NashornLinker.java    License: 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 #12
Source Project: jdk8u60   Author: chenghanpeng   File: NashornBeansLinker.java    License: 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 Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: NashornLinker.java    License: 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 Project: openjdk-jdk8u   Author: AdoptOpenJDK   File: NashornBeansLinker.java    License: 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 #15
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: NashornLinker.java    License: 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 #16
Source Project: openjdk-jdk8u-backup   Author: AdoptOpenJDK   File: NashornBeansLinker.java    License: 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 Project: openjdk-jdk9   Author: AdoptOpenJDK   File: NashornLinker.java    License: 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 Project: openjdk-jdk9   Author: AdoptOpenJDK   File: NashornBeansLinker.java    License: 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 #19
Source Project: hottub   Author: dsrg-uoft   File: NashornLinker.java    License: 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 #20
Source Project: hottub   Author: dsrg-uoft   File: NashornBeansLinker.java    License: 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 #21
Source Project: openjdk-8-source   Author: keerath   File: NashornLinker.java    License: 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 #22
Source Project: openjdk-8   Author: bpupadhyaya   File: NashornLinker.java    License: 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 #23
Source Project: jdk8u_nashorn   Author: JetBrains   File: NashornLinker.java    License: 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 Project: jdk8u_nashorn   Author: JetBrains   File: NashornBeansLinker.java    License: 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);
}