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

Scala example source code file (MethodInfo.java)

This example Scala source code file (MethodInfo.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

declaringtype, empty_array, hasptrparamorrettype, isconstructor, membertype, methodbase, methodinfo, methodinfo, name, parameterinfo, returntype, returntype, type, type, util

The Scala MethodInfo.java source code

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


package ch.epfl.lamp.compiler.msil;

import java.util.Iterator;

/**
 * Discovers the attributes of a method and provides access to method metadata.
 *
 * @author Nikolay Mihaylov
 * @version 1.0
 */
public class MethodInfo extends MethodBase {

    public boolean HasPtrParamOrRetType() {
        if(ReturnType.IsByRef() && !(ReturnType.GetElementType().IsValueType())) {
            /* A method returning ByRef won't pass peverify, so I guess this is dead code. */
            return true;
        }
        if(ReturnType.IsPointer()) {
            return true;
        }
        return super.HasPtrParamOrRetType();
    }

    //##########################################################################
    // public members

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

    public final boolean IsConstructor() { return false; }

    /** The return type of this method.
     */
    public final Type ReturnType;

    //##########################################################################
    // protected members

    protected static final MethodInfo[] EMPTY_ARRAY = new MethodInfo[0];

    /**
     * Constructor Initializes a new instance of the MethodInfo class.
     */
    protected MethodInfo(String name, Type declType,
			 int attrs, Type returnType, Type[] paramTypes )
    {
	super(name, declType, attrs, paramTypes);
	ReturnType = returnType;
    }

    protected MethodInfo(String name, Type declType,
			 int attrs, Type returnType, ParameterInfo[] params )
    {
	super(name, declType, attrs, params);
	ReturnType = returnType;
    }

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

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

}  // class MethodInfo

Other Scala examples (source code examples)

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

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

#1 New Release!

FP Best Seller

 

new blog posts

 

Copyright 1998-2024 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.