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

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

There is a newer version: 1.3.3
Show newest version
"""The Ceylon metamodel closed type and model package.
   
   As described in the [ceylon.language.meta](../index.html) documentation, this package contains all
   the types that represent Ceylon closed types and models.
   
   ### Usage example
   
   The following code will list all the value declarations in the `ceylon.language` package and print their
   current value:
   
       Package languagePackage = `package ceylon.language`;
       ValueDeclaration[] valueDeclarations = languagePackage.members();
       Value[] valueModels = valueDeclarations*.apply();
       for(val in valueModels){
           // skip the nothing value which cannot be read
           if(val.type != `Nothing`){
               print(val.get());
           }
       }
	
   The following code will iterate all the class declarations in the `ceylon.language` package that
   are not abstract, anonymous or annotations, and that have no type parameters nor initialiser
   parameters. For each matching class, we will apply it to get a class model which we can then
   use to instantiate the class and display its instance:
   
       for(decl in `package ceylon.language`.members()){
           if(!decl.abstract 
                   && !decl.anonymous 
                   && !decl.annotation
                   && decl.parameterDeclarations.empty
                   && decl.typeParameterDeclarations.empty){
               Class classModel = decl.classApply();
               Object instance = classModel();
               print("Instance of ``decl.name`` is: ``instance``");
           }
       }
   """
by ("Gavin King", "Stephane Epardaud", "Tom Bentley")
tagged("Metamodel")
shared package ceylon.language.meta.model;




© 2015 - 2024 Weber Informatics LLC | Privacy Policy