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

Scala example source code file (JObjectType.java)

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

cloneable, cloneable, java_io_serializable, java_lang_object, java_lang_string, jobjecttype, jobjecttype, jreferencetype, l, l, string, string, t_object

The Scala JObjectType.java source code

/* FJBG -- Fast Java Bytecode Generator
 * Copyright 2002-2011 LAMP/EPFL
 * @author  Michel Schinz
 */

package ch.epfl.lamp.fjbg;

/**
 * Types for Java objects.
 *
 * @author Michel Schinz
 * @version 1.0
 */

public class JObjectType extends JReferenceType {
    protected final String name;
    protected String signature = null;

    public final static JObjectType JAVA_LANG_OBJECT =
        new JObjectType("java.lang.Object");
    public final static JObjectType JAVA_LANG_STRING =
        new JObjectType("java.lang.String");
    public final static JObjectType CLONEABLE =
        new JObjectType("Cloneable");
    public final static JObjectType JAVA_IO_SERIALIZABLE =
        new JObjectType("java.io.Serializable");

    public JObjectType(String name) {
        this.name = name;
    }

    public int getSize() { return 1; }

    public String getName() { return name; }

    public String getSignature() {
        if (signature == null)
            signature = "L" + name.replace('.','/') + ";";
        return signature;
    }

    public String getDescriptor() {
        return name.replace('.','/');
    }

    public int getTag() { return T_OBJECT; }

    public String toString() { return name; }

    public boolean isObjectType() { return true; }

    public boolean isCompatibleWith(JType other) {
        return other instanceof JObjectType
            || other == JType.REFERENCE;
    }
    public boolean equals(Object o) {
        if (o instanceof JObjectType)
            return ((JObjectType)o).getSignature().equals(this.getSignature());
        else
            return false;
    }
    public int hashCode() {
        return name.hashCode();
    }
}

Other Scala examples (source code examples)

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