DbRuntimeClass.java

src/net/sourceforge/pain/db/DbRuntimeClass.java · 1.1 KB

From the archive pain_0_41.zip

Download the archive   « Back to the archive contents

package net.sourceforge.pain.db;

import java.lang.reflect.*;
import java.io.*;

/**
 * User: fmike  Date: 12.03.2003  Time: 18:51:13
 */
final class DbRuntimeClass extends DbClassImpl {

//	final Set objects = new HashSet();
	final DbClassImage image;
	private final Class objectClass;
	private final Constructor readConstructor;

	DbRuntimeClass(final DbClassImage image) throws RuntimeException {
		super(image.getDB(), image.getFieldTypes(), image.getFieldNames(), image.getClassName());
		this.image = image;
		try {
			objectClass = Class.forName(getClassName());
			readConstructor = objectClass.getDeclaredConstructor(new Class[0]);
		} catch (Exception e) {
			throw new RuntimeException(e);
		}
		image.setDbRuntimeClass(this);
	}

	Class getObjectClass() {
		return objectClass;
	}

	Constructor getReadConstructor() {
		return readConstructor;
	}

	int[] getPageNums() {
		return image.pageNums;
	}

	int getClassId() {
		return image.indexId;
	}

	public final void delete() {
		getDB().removeClass(this);
	}

	public Serializable getOid() {
		return image.getOid();
	}


}

Site Stats

Snippets: 1791
Codebases: 571