当前位置: 首页>>代码示例>>Java>>正文


Java ReflectHelper.isPublic方法代码示例

本文整理汇总了Java中org.hibernate.util.ReflectHelper.isPublic方法的典型用法代码示例。如果您正苦于以下问题:Java ReflectHelper.isPublic方法的具体用法?Java ReflectHelper.isPublic怎么用?Java ReflectHelper.isPublic使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.hibernate.util.ReflectHelper的用法示例。


在下文中一共展示了ReflectHelper.isPublic方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSetterOrNull

import org.hibernate.util.ReflectHelper; //导入方法依赖的package包/类
private static BasicSetter getSetterOrNull(Class theClass, String propertyName) {

		if (theClass==Object.class || theClass==null) return null;

		Method method = setterMethod(theClass, propertyName);

		if (method!=null) {
			if ( !ReflectHelper.isPublic(theClass, method) ) method.setAccessible(true);
			return new BasicSetter(theClass, method, propertyName);
		}
		else {
			BasicSetter setter = getSetterOrNull( theClass.getSuperclass(), propertyName );
			if (setter==null) {
				Class[] interfaces = theClass.getInterfaces();
				for ( int i=0; setter==null && i<interfaces.length; i++ ) {
					setter=getSetterOrNull( interfaces[i], propertyName );
				}
			}
			return setter;
		}

	}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:23,代码来源:BasicPropertyAccessor.java

示例2: getGetterOrNull

import org.hibernate.util.ReflectHelper; //导入方法依赖的package包/类
private static BasicGetter getGetterOrNull(Class theClass, String propertyName) {

		if (theClass==Object.class || theClass==null) return null;

		Method method = getterMethod(theClass, propertyName);

		if (method!=null) {
			if ( !ReflectHelper.isPublic(theClass, method) ) method.setAccessible(true);
			return new BasicGetter(theClass, method, propertyName);
		}
		else {
			BasicGetter getter = getGetterOrNull( theClass.getSuperclass(), propertyName );
			if (getter==null) {
				Class[] interfaces = theClass.getInterfaces();
				for ( int i=0; getter==null && i<interfaces.length; i++ ) {
					getter=getGetterOrNull( interfaces[i], propertyName );
				}
			}
			return getter;
		}
	}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:22,代码来源:BasicPropertyAccessor.java

示例3: getSetterOrNull

import org.hibernate.util.ReflectHelper; //导入方法依赖的package包/类
/**
 * @param theClass Target class in which the value is to be set
 * @param propertyName Target property name
 * @return returns Setter class instance
 */
@SuppressWarnings("PMD.AccessorClassGeneration")
private static CollectionPropertySetter getSetterOrNull(Class theClass, String propertyName) {

    if (theClass == Object.class || theClass == null) {
        return null;
    }

    Method method  =  setterMethod(theClass, propertyName);

    if (method != null) {
        if (!ReflectHelper.isPublic(theClass, method)) {
            method.setAccessible(true); 
        }
        return new CollectionPropertySetter(theClass, method, propertyName);
    } else {
        CollectionPropertySetter setter  =  getSetterOrNull(theClass.getSuperclass(), propertyName);
        if (setter == null) {
            Class[] interfaces = theClass.getInterfaces();
            for (int i = 0; setter == null && i < interfaces.length; i++) {
                setter = getSetterOrNull(interfaces[i], propertyName);
            }
        }
        return setter;
    }
}
 
开发者ID:NCIP,项目名称:iso21090,代码行数:31,代码来源:CollectionPropertyAccessor.java

示例4: getField

import org.hibernate.util.ReflectHelper; //导入方法依赖的package包/类
private static Field getField(Class clazz, String name) throws PropertyNotFoundException {
	if ( clazz==null || clazz==Object.class ) {
		throw new PropertyNotFoundException("field not found: " + name); 
	}
	Field field;
	try {
		field = clazz.getDeclaredField(name);
	}
	catch (NoSuchFieldException nsfe) {
		field = getField( clazz, clazz.getSuperclass(), name );
	}
	if ( !ReflectHelper.isPublic(clazz, field) ) field.setAccessible(true);
	return field;
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:15,代码来源:DirectPropertyAccessor.java

示例5: invoke

import org.hibernate.util.ReflectHelper; //导入方法依赖的package包/类
public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
	if ( constructed ) {
		Object result = invoke( method, args, proxy );
		if ( result == INVOKE_IMPLEMENTATION ) {
			Object target = getImplementation();
			try {
				final Object returnValue;
				if ( ReflectHelper.isPublic( persistentClass, method ) ) {
					if ( ! method.getDeclaringClass().isInstance( target ) ) {
						throw new ClassCastException( target.getClass().getName() );
					}
					returnValue = method.invoke( target, args );
				}
				else {
					if ( !method.isAccessible() ) {
						method.setAccessible( true );
					}
					returnValue = method.invoke( target, args );
				}
				return returnValue == target ? proxy : returnValue;
			}
			catch ( InvocationTargetException ite ) {
				throw ite.getTargetException();
			}
		}
		else {
			return result;
		}
	}
	else {
		// while constructor is running
		if ( method.getName().equals( "getHibernateLazyInitializer" ) ) {
			return this;
		}
		else {
			throw new LazyInitializationException( "unexpected case hit, method=" + method.getName() );
		}
	}
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:40,代码来源:CGLIBLazyInitializer.java

示例6: invoke

import org.hibernate.util.ReflectHelper; //导入方法依赖的package包/类
public Object invoke(
		final Object proxy,
		final Method thisMethod,
		final Method proceed,
		final Object[] args) throws Throwable {
	if ( this.constructed ) {
		Object result;
		try {
			result = this.invoke( thisMethod, args, proxy );
		}
		catch ( Throwable t ) {
			throw new Exception( t.getCause() );
		}
		if ( result == INVOKE_IMPLEMENTATION ) {
			Object target = getImplementation();
			final Object returnValue;
			try {
                   if ( ReflectHelper.isPublic( persistentClass, thisMethod ) ) {
					if ( ! thisMethod.getDeclaringClass().isInstance( target ) ) {
                   		throw new ClassCastException( target.getClass().getName() );
					}
                   	returnValue = thisMethod.invoke( target, args );
                   }
                   else {
                   	if ( !thisMethod.isAccessible() ) {
                   		thisMethod.setAccessible( true );
                   	}
                   	returnValue = thisMethod.invoke( target, args );
                   }
                   return returnValue == target ? proxy : returnValue;
               }
			catch ( InvocationTargetException ite ) {
                   throw ite.getTargetException();
               }
		}
		else {
			return result;
		}
	}
	else {
		// while constructor is running
		if ( thisMethod.getName().equals( "getHibernateLazyInitializer" ) ) {
			return this;
		}
		else {
			return proceed.invoke( proxy, args );
		}
	}
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:50,代码来源:JavassistLazyInitializer.java


注:本文中的org.hibernate.util.ReflectHelper.isPublic方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。