[ 
https://issues.apache.org/jira/browse/FLINK-1062?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14108931#comment-14108931
 ] 

Stephan Ewen commented on FLINK-1062:
-------------------------------------

A simple type on extracting simple return types of methods like {{map()}}, 
{{join()}}, etc

{code}
    public static Class<?>[] getTypesFromSerializedLambda(SerializedLambda sl) 
throws Exception {
        String sig = sl.getImplMethodSignature();

        if (!sig.startsWith("(")) {
            throw new Exception("Parse Error");
        }

        String parameters = sig.substring(1, sig.indexOf(')'));
        String[] params = parameters.split(";");

        List<Class<?>> classes = new ArrayList<>();

        for (String p : params) {
            if (!p.startsWith("L")) {
                throw new Exception("Parse Error");
            }

            p = p.substring(1);
            p = p.replace('/', '.');
            classes.add(Class.forName(p));
        }


        return (Class<?>[]) classes.toArray(new Class<?>[classes.size()]);
    }
{code}

> Type Extraction for Lambdas
> ---------------------------
>
>                 Key: FLINK-1062
>                 URL: https://issues.apache.org/jira/browse/FLINK-1062
>             Project: Flink
>          Issue Type: Improvement
>          Components: Java API
>    Affects Versions: 0.7-incubating
>            Reporter: Stephan Ewen
>             Fix For: 0.7-incubating
>
>
> Lambdas currently work only for {{filter}} and {{reduce(a,b)}}, because 
> Lambda type extraction is not in place right now.
> We need to extend the type extraction for lambdas to support the other 
> functions.



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to