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

com.gemstone.org.jgroups.conf.ClassMap Maven / Gradle / Ivy

There is a newer version: 2.0-BETA
Show newest version
/** Notice of modification as required by the LGPL
 *  This file was modified by Gemstone Systems Inc. on
 *  $Date$
 **/
// $Id: ClassMap.java,v 1.4 2005/08/08 14:58:32 belaban Exp $

package com.gemstone.org.jgroups.conf;

import com.gemstone.org.jgroups.util.Util;


/**
 * Maintains mapping between magic number and class
 *
 * @author Filip Hanik ([email protected])
 * @version 1.0
 */
public class ClassMap {
    private final String  mClassname;
    private final String  mDescription;
    private final boolean mPreload;
    private final int     mMagicNumber;

    public ClassMap(String clazz,
                    String desc,
                    boolean preload,
                    int magicnumber) {
        mClassname=clazz;
        mDescription=desc;
        mPreload=preload;
        mMagicNumber=magicnumber;
    }

    @Override // GemStoneAddition
    public int hashCode() {
        return getMagicNumber();
    }

    public String getClassName() {
        return mClassname;
    }

    public String getDescription() {
        return mDescription;
    }

    public boolean getPreload() {
        return mPreload;
    }

    public int getMagicNumber() {
        return mMagicNumber;
    }


    /**
     * Returns the Class object for this class
*/ public Class getClassForMap() throws ClassNotFoundException { return Util.loadClass(getClassName(), this.getClass()); } @Override // GemStoneAddition public boolean equals(Object another) { if(another instanceof ClassMap) { ClassMap obj=(ClassMap)another; return getClassName().equals(obj.getClassName()); } else return false; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy