ceylon.language.meta.model.Method.ceylon Maven / Gradle / Ivy
import ceylon.language.meta.declaration{FunctionDeclaration}
"""A function model represents the model of a Ceylon function that you can invoke and inspect.
A method is a member function: it is declared on classes or interfaces.
This is both a [[FunctionModel]] and a [[Member]]: you can invoke it with an instance value
to bind it to that instance and obtain a [[Function]]:
class Outer(){
shared String foo(String name) => "Hello "+name;
}
void test(){
Method method = `Outer.foo`;
// Bind it to an instance value
Function f = method(Outer());
// This will print: Hello Stef
print(f("Stef"));
}
"""
shared sealed interface Method
satisfies FunctionModel & Member>
given Arguments satisfies Anything[] {
"This function's declaration."
shared formal actual FunctionDeclaration declaration;
shared actual formal Function bind(Anything container);
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy