Files
Brainstorm/Orb/src/com/de22/orb/DefaultProxyInterfaceLoader.java

50 lines
1.8 KiB
Java
Raw Normal View History

2014-05-30 10:31:51 -07:00
/*
* Copyright (c) 2008,2009 Declarative Engineering LLC.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Declarative Engineering LLC
* verson 1 which accompanies this distribution, and is available at
* http://declarativeengineering.com/legal/DE_Developer_License_v1.txt
*/
package com.de22.orb;
public class DefaultProxyInterfaceLoader implements IProxyInterfaceLoader {
/**
* DefaultProxyInterfaceLoader constructor.
*/
public DefaultProxyInterfaceLoader() {
}//DefaultProxyInterfaceLoader()//
/* (non-Javadoc)
* @see com.de22.orb.IProxyInterfaceLoader#loadDefaultProxyInterface(java.lang.Object, java.lang.ClassLoader)
*/
public Class loadDefaultProxyInterface(Object proxiedObject, ClassLoader classLoader) throws ClassNotFoundException {
Class result = null;
String interfaceClassName = proxiedObject.getClass().getName();
int index = interfaceClassName.lastIndexOf('.') + 1;
interfaceClassName = interfaceClassName.substring(0, index) + 'I' + interfaceClassName.substring(index);
if(classLoader == null) {
result = Class.forName(interfaceClassName);
}//if//
else {
result = classLoader.loadClass(interfaceClassName);
}//else//
return result;
}//loadDefaultProxyInterface()//
/* (non-Javadoc)
* @see com.de22.orb.IProxyInterfaceLoader#loadProxyClass(java.lang.Class, java.lang.ClassLoader)
*/
public Class loadProxyClass(Class interfaceClass, ClassLoader classLoader) throws ClassNotFoundException {
Class result = null;
if(classLoader == null) {
result = Class.forName(interfaceClass.getName() + Proxy.PROXY_EXTENSION);
}//if//
else {
result = classLoader.loadClass(interfaceClass.getName() + Proxy.PROXY_EXTENSION);
}//else//
return result;
}//loadProxyClass()//
}//DefaultProxyInterfaceLoader//