All Downloads are FREE. Search and download functionalities are using the official Maven repository.

ceylon.language.unflatten_ Maven / Gradle / Ivy

There is a newer version: 1.3.3
Show newest version
package ceylon.language;

import com.redhat.ceylon.compiler.java.Util;
import com.redhat.ceylon.compiler.java.language.AbstractCallable;
import com.redhat.ceylon.compiler.java.metadata.Ceylon;
import com.redhat.ceylon.compiler.java.metadata.FunctionalParameter;
import com.redhat.ceylon.compiler.java.metadata.Ignore;
import com.redhat.ceylon.compiler.java.metadata.Method;
import com.redhat.ceylon.compiler.java.metadata.Name;
import com.redhat.ceylon.compiler.java.metadata.TypeInfo;
import com.redhat.ceylon.compiler.java.metadata.TypeParameter;
import com.redhat.ceylon.compiler.java.metadata.TypeParameters;
import com.redhat.ceylon.compiler.java.runtime.model.TypeDescriptor;

@Ceylon(major = 8)
@Method
public final class unflatten_ {
    
    private unflatten_() {}
    
    @TypeParameters({@TypeParameter(value="Return"),
                     @TypeParameter(value="Args", satisfies="ceylon.language::Sequential")})
    @TypeInfo("ceylon.language::Callable>")
    @FunctionalParameter("(args)")
    public static  Callable unflatten(
        @Ignore TypeDescriptor $reifiedReturn,
        @Ignore TypeDescriptor $reifiedArgs,
        @Name("flatFunction")
        @TypeInfo("ceylon.language::Callable")
        final Callable flatFunction) {
        
        return new AbstractCallable($reifiedReturn, 
                TypeDescriptor.klass(Tuple.class, $reifiedArgs, $reifiedArgs, Empty.$TypeDescriptor$), 
                null, (short)-1) {

            @Override
            public Return $call$() {
                throw new UnsupportedOperationException();
            }

            @Override
            public Return $call$(java.lang.Object arg0) {
                Sequential seq = (Sequential) arg0;
                return Util.apply(flatFunction, seq, null);
            }

            @Override
            public Return $call$(java.lang.Object arg0, java.lang.Object arg1) {
                throw new UnsupportedOperationException();
            }

            @Override
            public Return $call$(java.lang.Object arg0, java.lang.Object arg1, java.lang.Object arg2) {
                throw new UnsupportedOperationException();
            }

            @Override
            public Return $call$(java.lang.Object... args) {
                throw new UnsupportedOperationException();
            }

            @Override
            public java.lang.String toString() {
                return $getType$().toString();
            }
        };
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy