private static Implementation getRestrictionCoderDelegation( TypeDescription doFnType, DoFnSignature signature) { if (signature.processElement().isSplittable()) { if (signature.getRestrictionCoder() == null) { return MethodDelegation.to( new DefaultRestrictionCoder(signature.getInitialRestriction().restrictionT())); } else { return new DowncastingParametersMethodDelegation( doFnType, signature.getRestrictionCoder().targetMethod()); } } else { return ExceptionMethod.throwing(UnsupportedOperationException.class); } }
/** Delegates to the given method if available, or throws UnsupportedOperationException. */ private static Implementation delegateWithDowncastOrThrow( TypeDescription doFnType, DoFnSignature.DoFnMethod method) { return (method == null) ? ExceptionMethod.throwing(UnsupportedOperationException.class) : new DowncastingParametersMethodDelegation(doFnType, method.targetMethod()); }
private static Implementation splitRestrictionDelegation( TypeDescription doFnType, DoFnSignature signature) { if (signature.splitRestriction() == null) { return MethodDelegation.to(DefaultSplitRestriction.class); } else { return new DowncastingParametersMethodDelegation( doFnType, signature.splitRestriction().targetMethod()); } }