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

ceylon.language.meta.model.CallableConstructor.ceylon Maven / Gradle / Ivy

There is a newer version: 1.3.3
Show newest version
import ceylon.language.meta.declaration{CallableConstructorDeclaration}

"""A callable constructor model represents the model of a Ceylon class 
   constructor that you can invoke and inspect
   
   ## Callablity
   
   As with [[Function]] you can also invoke a `CallableConstructor`, doing so 
   instantiates an instance:
   
        shared class Foo {
            shared String name;
            shared new foo(String name) {
                this.name = name;
            }
        }
        
        void test() {
        Constructor ctor = `Foo.foo`;
        // This will print: Stef
        print(ctor("Stef").name);
        
   ## Genericity
        
   This class inherits [[Generic]] but a constructor in Ceylon cannot 
   have a type parameters. 
   For symmetry with [[CallableConstructorDeclaration.apply]] the 
   [[typeArguments]] and [[typeArgumentList]] refer to the type arguments 
   of the constructor's class.
   """
shared sealed interface CallableConstructor
        satisfies FunctionModel & Applicable
        given Arguments satisfies Anything[] {
    
    "This constructor's declaration."
    shared formal actual CallableConstructorDeclaration declaration;
    
    shared formal actual ClassModel type;
    
    "The class containing this constructor; the type of instances produced 
     by this constructor."
    shared actual formal ClassModel? container;
    
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy