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

Scala example source code file (PrimitiveType.java)

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

constructorinfo, constructorinfo, fieldinfo, fieldinfo, methodinfo, methodinfo, pecustommod, primitivetype, string, type, type

The Scala PrimitiveType.java source code

package ch.epfl.lamp.compiler.msil;

import ch.epfl.lamp.compiler.msil.util.PECustomMod; 

public final class PrimitiveType extends Type {
    public PrimitiveType(Module module,
                         int attributes,
                         String fullName,
                         Type baseType,
                         Type[] interfaces,
                         Type declType,
                         int auxAttr,
                         Type elemType) {
        super(module, attributes, fullName,
                baseType, interfaces, declType, auxAttr, elemType);
        clearMembers();
    }

    public void clearMembers() {
        fields = FieldInfo.EMPTY_ARRAY;
        methods = MethodInfo.EMPTY_ARRAY;
        constructors = ConstructorInfo.EMPTY_ARRAY;
        events = EventInfo.EMPTY_ARRAY;

        initBaseType();
        initInterfaces();

        initFields();
        initMethods();
        initEvents();
        initProperties();
        initNestedTypes();        
    }

    public FieldInfo addField(String name, int attrs, Type fieldType) {
        PECustomMod fieldTypeWithMods = new PECustomMod(fieldType, null); 
        FieldInfo res = new FieldInfo(name, this, attrs, fieldTypeWithMods, null);
        FieldInfo[] ms = new FieldInfo[fields.length + 1];
        System.arraycopy(fields, 0, ms, 0, fields.length);
        ms[ms.length - 1] = res;
        fields = ms;
        return res;
    }

    public MethodInfo addMethod(String name, int attrs, Type returnType, Type[] paramTypes) {
        MethodInfo res = new MethodInfo(name, this, attrs, returnType, paramTypes);
        MethodInfo[] ms = new MethodInfo[methods.length + 1];
        System.arraycopy(methods, 0, ms, 0, methods.length);
        ms[ms.length - 1] = res;
        return res;
    }
    
    public ConstructorInfo addConstructor(int attrs, Type[] paramTypes) {
        ConstructorInfo res = new ConstructorInfo(this, attrs, paramTypes);
        ConstructorInfo[] ms = new ConstructorInfo[constructors.length + 1];
        System.arraycopy(constructors, 0, ms, 0, constructors.length);
        ms[ms.length - 1] = res;
        return res;
    }

}

Other Scala examples (source code examples)

Here is a short list of links related to this Scala PrimitiveType.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.