Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package org.dynjs.runtime.linker.java;
 
 
    private static MethodHandle FILTER_HANDLE;
    static {
        try {
             = lookup().findStatic(JavaNullReplacingLinkStrategy.class"filter", MethodType.methodType(Object.classObject.class));
        } catch (NoSuchMethodException | IllegalAccessException e) {
            e.printStackTrace();
        }
    }
    public JavaNullReplacingLinkStrategy(LinkLogger logger) {
        super(ExecutionContext.classlogger);
    }
    @Override
    public StrategicLink linkGetProperty(StrategyChain chainObject receiverString propNameBinder binderBinder guardBinderthrows NoSuchMethodException,
            IllegalAccessException {
        StrategicLink link = super.linkGetProperty(chainreceiverpropNamebinderguardBinder);
        if (link != null) {
            MethodHandle target = link.getTarget();
            return new StrategicLink(Binder.from(target.type()).filterReturn().invoke(target), link.getGuard());
        }
        return null;
    }
    @Override
    public StrategicLink linkGetMethod(StrategyChain chainObject receiverString methodNameBinder binderBinder guardBinderthrows NoSuchMethodException,
            IllegalAccessException {
        StrategicLink link = super.linkGetMethod(chainreceivermethodNamebinderguardBinder);
        if (link != null) {
            MethodHandle target = link.getTarget();
            return new StrategicLink(Binder.from(target.type()).filterReturn().invoke(target), link.getGuard());
        }
        return null;
    }
    @Override
    public StrategicLink linkCall(StrategyChain chainObject receiverObject selfObject[] argsBinder binderBinder guardBinderthrows NoSuchMethodException,
            IllegalAccessException {
        // TODO Auto-generated method stub
        StrategicLink link = super.linkCall(chainreceiverselfargsbinderguardBinder);
        if (link != null) {
            MethodHandle target = link.getTarget();
            return new StrategicLink(Binder.from(target.type()).filterReturn().invoke(target), link.getGuard());
        }
        return null;
    }
    public static Object filter(Object value) {
        if (value == null) {
            return .;
        }
        return value;
    }
New to GrepCode? Check out our FAQ X