Java 8 CallSite - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 CallSite class.

This code example shows how to use the following methods:getTarget
    public void addLinker(Linker linker) {
        this.linker.addLinker( linker );
    } 
 
    public Object get(Object object, ExecutionContext context, String propertyName) throws Throwable {
        return this.get.getTarget().invoke(object, context, propertyName);
    } 
 
    public void set(Object object, ExecutionContext context, String propertyName, Object value) throws Throwable {
        this.set.getTarget().invoke(object, context, propertyName, value);
    } 
 
    public Object call(Object method, ExecutionContext context, Object self, Object... args) throws Throwable {
        return this.call.getTarget().invoke(method, context, self, args);
    } 
     
    public Object construct(Object ctor, ExecutionContext context, Object... args) throws Throwable {
        return this.construct.getTarget().invoke(ctor, context, args);
    } 
 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setTarget
CallSite callSite = new LilaCallSite(type);
		MethodHandle target = fallback.bindTo(callSite)
			// -1: function 
			.asCollector(LilaObject[].class, type.parameterCount() - 1);
	    callSite.setTarget(target);
		return callSite;
	} 
 
	// generic fallback handler for all calls 
	public static LilaObject fallback 
	    (LilaCallSite callSite, LilaObject object, LilaObject[] args)
		throws Throwable
    { 
		if (object instanceof LilaCallable) {
			LilaCallable callable = (LilaCallable)object;
			return callable.fallback(callSite, callable, args);
		} else 
			throw new RuntimeException("unable to call: " + object);
    } 
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:setTarget
                        .parameterCount()
                        - boundInvoker.type().parameterCount() + 1);
        MethodHandle convertedArgsInvoker =
                MethodHandles.convertArguments(collectedArgsInvoker,
                        callSiteType);
        cs.setTarget(convertedArgsInvoker);
        return cs;
    } 
 
    private static MethodHandle INVOKE_DYNAMICALLY;
    static { 
        try { 
            INVOKE_DYNAMICALLY =
                    MethodHandles.lookup().findStatic(
                            DynamicDispatchDemo.class, 
                            "invokeDynamically", 
                            MethodType.methodType(Object.class,
                                    RelinkableCallSite.class, Object[].class)); 
        } catch(IllegalAccessException e) {
            throw new UndeclaredThrowableException(e);
3
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Java 8 CallSite Methods: