本文整理汇总了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;
}
}
示例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;
}
}
示例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;
}
}
示例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;
}
示例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() );
}
}
}
示例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 );
}
}
}