alvinalexander.com | career | drupal | java | mac | mysql | perl | scala | uml | unix  

Scala example source code file (ConstructorInfo.java)

This example Scala source code file (ConstructorInfo.java) is included in the DevDaily.com "Java Source Code Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.

Java - Scala tags/keywords

cctor, constructorinfo, constructorinfo, ctor, ctor, empty_array, methodbase, name, owner, owner, parameterinfo, string, string, type

The Scala ConstructorInfo.java source code

/*
 * System.Reflection-like API for access to .NET assemblies (DLL & EXE)
 */


package ch.epfl.lamp.compiler.msil;

/**
 * Discovers the attributes of a class constructor and provides
 * access to constructor metadata.
 * ConstructorInfo is used to discover the attributes of a constructor
 * as well as to invoke a constructor. Objects are created by invoking
 * either the GetConstructors or GetConstructor method of a Type object.
 *
 * @author Nikolay Mihaylov
 * @version 1.0
 */
public class ConstructorInfo extends MethodBase {
    //##########################################################################

    public final int MemberType() { return MemberTypes.Constructor; }

    public final boolean IsConstructor() { return true; }

    protected static final String CTOR = ".ctor";
    protected static final String CCTOR = ".cctor";
    protected static final ConstructorInfo[] EMPTY_ARRAY = new ConstructorInfo[0];

    protected static String getName(int attrs) {
	  return (attrs & MethodAttributes.Static) == 0 ? CTOR : CCTOR;
    }

    /** Public constructors */

    public ConstructorInfo(Type declType, int attrs, Type[] paramTypes) {
	  super(getName(attrs), declType, attrs, paramTypes);
	  assert declType != null : "Owner can't be 'null' for a constructor!";
    }

    public ConstructorInfo(Type declType, int attrs, ParameterInfo[] params)
    {
	  super(getName(attrs), declType, attrs, params);
	  assert declType != null : "Owner can't be 'null' for a constructor!";
    }


    public String toString() {
	return MethodAttributes.toString(Attributes) + " " + Type.VOID() +
	    " " + DeclaringType.FullName + "::" + Name + params2String();
    }

    //##########################################################################

} // class ConstructorInfo

Other Scala examples (source code examples)

Here is a short list of links related to this Scala ConstructorInfo.java source code file:

... this post is sponsored by my books ...

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.

A percentage of advertising revenue from
pages under the /java/jwarehouse URI on this website is
paid back to open source projects.