本文整理汇总了Java中org.hibernate.util.ReflectHelper.classForName方法的典型用法代码示例。如果您正苦于以下问题:Java ReflectHelper.classForName方法的具体用法?Java ReflectHelper.classForName怎么用?Java ReflectHelper.classForName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.hibernate.util.ReflectHelper
的用法示例。
在下文中一共展示了ReflectHelper.classForName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getElementClass
import org.hibernate.util.ReflectHelper; //导入方法依赖的package包/类
public Class getElementClass() throws MappingException {
if (elementClassName==null) {
org.hibernate.type.Type elementType = getElement().getType();
return isPrimitiveArray() ?
( (PrimitiveType) elementType ).getPrimitiveClass() :
elementType.getReturnedClass();
}
else {
try {
return ReflectHelper.classForName(elementClassName);
}
catch (ClassNotFoundException cnfe) {
throw new MappingException(cnfe);
}
}
}
示例2: customCollection
import org.hibernate.util.ReflectHelper; //导入方法依赖的package包/类
public static CollectionType customCollection(
String typeName,
Properties typeParameters,
String role,
String propertyRef,
boolean embedded) {
Class typeClass;
try {
typeClass = ReflectHelper.classForName( typeName );
}
catch ( ClassNotFoundException cnfe ) {
throw new MappingException( "user collection type class not found: " + typeName, cnfe );
}
CustomCollectionType result = new CustomCollectionType( typeClass, role, propertyRef, embedded );
if ( typeParameters != null ) {
TypeFactory.injectParameters( result.getUserType(), typeParameters );
}
return result;
}
示例3: getComponentClass
import org.hibernate.util.ReflectHelper; //导入方法依赖的package包/类
public Class getComponentClass() throws MappingException {
try {
return ReflectHelper.classForName(componentClassName);
}
catch (ClassNotFoundException cnfe) {
throw new MappingException("component class not found: " + componentClassName, cnfe);
}
}
示例4: getMappedClass
import org.hibernate.util.ReflectHelper; //导入方法依赖的package包/类
public Class getMappedClass() throws MappingException {
if (className==null) return null;
try {
return ReflectHelper.classForName(className);
}
catch (ClassNotFoundException cnfe) {
throw new MappingException("entity class not found: " + className, cnfe);
}
}
示例5: getProxyInterface
import org.hibernate.util.ReflectHelper; //导入方法依赖的package包/类
public Class getProxyInterface() {
if (proxyInterfaceName==null) return null;
try {
return ReflectHelper.classForName(proxyInterfaceName);
}
catch (ClassNotFoundException cnfe) {
throw new MappingException("proxy class not found: " + proxyInterfaceName, cnfe);
}
}
示例6: resolveCustomAccessor
import org.hibernate.util.ReflectHelper; //导入方法依赖的package包/类
private static PropertyAccessor resolveCustomAccessor(String accessorName) {
Class accessorClass;
try {
accessorClass = ReflectHelper.classForName(accessorName);
}
catch (ClassNotFoundException cnfe) {
throw new MappingException("could not find PropertyAccessor class: " + accessorName, cnfe);
}
try {
return (PropertyAccessor) accessorClass.newInstance();
}
catch (Exception e) {
throw new MappingException("could not instantiate PropertyAccessor class: " + accessorName, e);
}
}
示例7: buildEntityTuplizer
import org.hibernate.util.ReflectHelper; //导入方法依赖的package包/类
private static EntityTuplizer buildEntityTuplizer(String className, PersistentClass pc, EntityMetamodel em) {
try {
Class implClass = ReflectHelper.classForName( className );
return ( EntityTuplizer ) implClass.getConstructor( ENTITY_TUP_CTOR_SIG ).newInstance( new Object[] { em, pc } );
}
catch( Throwable t ) {
throw new HibernateException( "Could not build tuplizer [" + className + "]", t );
}
}
示例8: buildComponentTuplizer
import org.hibernate.util.ReflectHelper; //导入方法依赖的package包/类
private ComponentTuplizer buildComponentTuplizer(String tuplizerImpl, Component component) {
try {
Class implClass = ReflectHelper.classForName( tuplizerImpl );
return ( ComponentTuplizer ) implClass.getConstructor( COMPONENT_TUP_CTOR_SIG ).newInstance( new Object[] { component } );
}
catch( Throwable t ) {
throw new HibernateException( "Could not build tuplizer [" + tuplizerImpl + "]", t );
}
}
示例9: buildOptimizer
import org.hibernate.util.ReflectHelper; //导入方法依赖的package包/类
public static Optimizer buildOptimizer(String type, Class returnClass, int incrementSize) {
String optimizerClassName;
if ( NONE.equals( type ) ) {
optimizerClassName = NoopOptimizer.class.getName();
}
else if ( HILO.equals( type ) ) {
optimizerClassName = HiLoOptimizer.class.getName();
}
else if ( POOL.equals( type ) ) {
optimizerClassName = PooledOptimizer.class.getName();
}
else {
optimizerClassName = type;
}
try {
Class optimizerClass = ReflectHelper.classForName( optimizerClassName );
Constructor ctor = optimizerClass.getConstructor( CTOR_SIG );
return ( Optimizer ) ctor.newInstance( new Object[] { returnClass, new Integer( incrementSize ) } );
}
catch( Throwable ignore ) {
// intentionally empty
}
// the default...
return new NoopOptimizer( returnClass, incrementSize );
}
示例10: getIdentifierGeneratorClass
import org.hibernate.util.ReflectHelper; //导入方法依赖的package包/类
public static Class getIdentifierGeneratorClass(String strategy, Dialect dialect) {
Class clazz = (Class) GENERATORS.get(strategy);
if ( "native".equals(strategy) ) clazz = dialect.getNativeIdentifierGeneratorClass();
try {
if (clazz==null) clazz = ReflectHelper.classForName(strategy);
}
catch (ClassNotFoundException e) {
throw new MappingException("could not interpret id generator strategy: " + strategy);
}
return clazz;
}
示例11: registerResultSetOutParameter
import org.hibernate.util.ReflectHelper; //导入方法依赖的package包/类
public int registerResultSetOutParameter(java.sql.CallableStatement statement,int col) throws SQLException {
if(oracletypes_cursor_value==0) {
try {
Class types = ReflectHelper.classForName("oracle.jdbc.driver.OracleTypes");
oracletypes_cursor_value = types.getField("CURSOR").getInt(types.newInstance());
} catch (Exception se) {
throw new HibernateException("Problem while trying to load or access OracleTypes.CURSOR value",se);
}
}
// register the type of the out param - an Oracle specific type
statement.registerOutParameter(col, oracletypes_cursor_value);
col++;
return col;
}
示例12: getImportedClassName
import org.hibernate.util.ReflectHelper; //导入方法依赖的package包/类
public String getImportedClassName(String className) {
String result = (String) imports.get(className);
if (result==null) {
try {
ReflectHelper.classForName(className);
return className;
}
catch (ClassNotFoundException cnfe) {
return null;
}
}
else {
return result;
}
}
示例13: buildCurrentSessionContext
import org.hibernate.util.ReflectHelper; //导入方法依赖的package包/类
private CurrentSessionContext buildCurrentSessionContext() {
String impl = properties.getProperty( Environment.CURRENT_SESSION_CONTEXT_CLASS );
// for backward-compatability
if ( impl == null && transactionManager != null ) {
impl = "jta";
}
if ( impl == null ) {
return null;
}
else if ( "jta".equals( impl ) ) {
if ( settings.getTransactionFactory().areCallbacksLocalToHibernateTransactions() ) {
log.warn( "JTASessionContext being used with JDBCTransactionFactory; auto-flush will not operate correctly with getCurrentSession()" );
}
return new JTASessionContext( this );
}
else if ( "thread".equals( impl ) ) {
return new ThreadLocalSessionContext( this );
}
else if ( "managed".equals( impl ) ) {
return new ManagedSessionContext( this );
}
else {
try {
Class implClass = ReflectHelper.classForName( impl );
return ( CurrentSessionContext ) implClass
.getConstructor( new Class[] { SessionFactoryImplementor.class } )
.newInstance( new Object[] { this } );
}
catch( Throwable t ) {
log.error( "Unable to construct current session context [" + impl + "]", t );
return null;
}
}
}
示例14: get
import org.hibernate.util.ReflectHelper; //导入方法依赖的package包/类
public Object get(ResultSet rs, String name) throws HibernateException, SQLException {
String str = (String) Hibernate.STRING.get(rs, name);
if (str == null) {
return null;
}
else {
try {
return ReflectHelper.classForName(str);
}
catch (ClassNotFoundException cnfe) {
throw new HibernateException("Class not found: " + str);
}
}
}
示例15: fromStringValue
import org.hibernate.util.ReflectHelper; //导入方法依赖的package包/类
public Object fromStringValue(String xml) throws HibernateException {
try {
return ReflectHelper.classForName(xml);
}
catch (ClassNotFoundException cnfe) {
throw new HibernateException("could not parse xml", cnfe);
}
}