// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   SpecificRootClass.java

package hep.rootio.implementation;

import hep.rootio.RootFileReader;
import hep.rootio.RootObjectRepresentation;

import java.lang.reflect.Method;

// Referenced classes of package hep.rootio.implementation:
//            GenericRootClass, SpecificRootObject, GenericRootObject, StreamerInfo

public class SpecificRootClass extends GenericRootClass
{

    SpecificRootClass(Class c, String name, StreamerInfo info, RootFileReader rfr)
    {
        super(name, info, rfr);
        if(!(hep.rootio.implementation.SpecificRootObject.class).isAssignableFrom(c))
            throw new RuntimeException("RootClass " + c.getName() + " is not a RootObjectRepresentation");
        javaClass = c;
        try
        {
            Method m = c.getMethod("getJavaType", noArgc);
            if(m.getReturnType() != (java.lang.String.class))
                throw new RuntimeException("Incorrect return type for getJavaType()");
            if((m.getModifiers() & 8) == 0)
                throw new RuntimeException("getJavaType() method should be static");
            javaType = (String)m.invoke(null, noArgs);
        }
        catch(Throwable throwable) { }
    }

    public RootObjectRepresentation newInstance()
    {
        try
        {
            SpecificRootObject rep = (SpecificRootObject)javaClass.newInstance();
            rep.init(this, super.streamerInfo);
            return rep;
        }
        catch(Exception exception)
        {
            throw new RuntimeException("Could not create instance of " + javaClass);
        }
    }

    public String getJavaType()
    {
        if(javaType != null)
            return javaType;
        else
            return super.getJavaType();
    }

    private static final Class noArgc[] = new Class[0];
    private static final Object noArgs[] = new Object[0];
    private Class javaClass;
    private String javaType;

}

 

Ads help maintain this website.