• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java PropertyNotFoundException类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: PojoInstantiator

import org.hibernate.PropertyNotFoundException; //导入依赖的package包/类
public PojoInstantiator(Component component, ReflectionOptimizer.InstantiationOptimizer optimizer) {
	this.mappedClass = component.getComponentClass();
	this.isAbstract = ReflectHelper.isAbstractClass( mappedClass );
	this.optimizer = optimizer;

	this.proxyInterface = null;
	this.embeddedIdentifier = false;

	try {
		constructor = ReflectHelper.getDefaultConstructor(mappedClass);
	}
	catch ( PropertyNotFoundException pnfe ) {
		LOG.noDefaultConstructor(mappedClass.getName());
		constructor = null;
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:17,代码来源:PojoInstantiator.java


示例2: setProperties

import org.hibernate.PropertyNotFoundException; //导入依赖的package包/类
public Query setProperties(Object bean) throws HibernateException {
	Class clazz = bean.getClass();
	String[] params = getNamedParameters();
	for (int i = 0; i < params.length; i++) {
		String namedParam = params[i];
		try {
			Getter getter = ReflectHelper.getGetter( clazz, namedParam );
			Class retType = getter.getReturnType();
			final Object object = getter.get( bean );
			if ( Collection.class.isAssignableFrom( retType ) ) {
				setParameterList( namedParam, ( Collection ) object );
			}
			else if ( retType.isArray() ) {
			 	setParameterList( namedParam, ( Object[] ) object );
			}
			else {
				setParameter( namedParam, object, determineType( namedParam, retType ) );
			}
		}
		catch (PropertyNotFoundException pnfe) {
			// ignore
		}
	}
	return this;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:AbstractQueryImpl.java


示例3: getDefaultConstructor

import org.hibernate.PropertyNotFoundException; //导入依赖的package包/类
/**
 * Retrieve the default (no arg) constructor from the given class.
 *
 * @param clazz The class for which to retrieve the default ctor.
 * @return The default constructor.
 * @throws PropertyNotFoundException Indicates there was not publicly accessible, no-arg constructor (todo : why PropertyNotFoundException???)
 */
public static <T> Constructor<T> getDefaultConstructor(Class<T> clazz) throws PropertyNotFoundException {
	if ( isAbstractClass( clazz ) ) {
		return null;
	}

	try {
		Constructor<T> constructor = clazz.getDeclaredConstructor( NO_PARAM_SIGNATURE );
		constructor.setAccessible( true );
		return constructor;
	}
	catch ( NoSuchMethodException nme ) {
		throw new PropertyNotFoundException(
				"Object class [" + clazz.getName() + "] must declare a default (no-argument) constructor"
		);
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:24,代码来源:ReflectHelper.java


示例4: getConstructor

import org.hibernate.PropertyNotFoundException; //导入依赖的package包/类
/**
 * Retrieve a constructor for the given class, with arguments matching the specified Hibernate mapping
 * {@link Type types}.
 *
 * @param clazz The class needing instantiation
 * @param types The types representing the required ctor param signature
 * @return The matching constructor.
 * @throws PropertyNotFoundException Indicates we could not locate an appropriate constructor (todo : again with PropertyNotFoundException???)
 */
public static Constructor getConstructor(Class clazz, Type[] types) throws PropertyNotFoundException {
	final Constructor[] candidates = clazz.getConstructors();
	for ( int i = 0; i < candidates.length; i++ ) {
		final Constructor constructor = candidates[i];
		final Class[] params = constructor.getParameterTypes();
		if ( params.length == types.length ) {
			boolean found = true;
			for ( int j = 0; j < params.length; j++ ) {
				final boolean ok = params[j].isAssignableFrom( types[j].getReturnedClass() ) || (
						types[j] instanceof PrimitiveType &&
								params[j] == ( ( PrimitiveType ) types[j] ).getPrimitiveClass()
				);
				if ( !ok ) {
					found = false;
					break;
				}
			}
			if ( found ) {
				constructor.setAccessible( true );
				return constructor;
			}
		}
	}
	throw new PropertyNotFoundException( "no appropriate constructor in class: " + clazz.getName() );
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:35,代码来源:ReflectHelper.java


示例5: extractPrimaryKeyValue

import org.hibernate.PropertyNotFoundException; //导入依赖的package包/类
public String extractPrimaryKeyValue(){
	//Get pk column and value
	String pkValue = null;
	try{
		pkValue = pc.getIdentifierProperty().getGetter(entity.getClass()).get(entity).toString();
	} catch(PropertyNotFoundException pnfe) {
		logger.info("PropertyNotFoundException " + pnfe.getMessage());
	} catch(MappingException me) {
		logger.info("MappingException " + me.getMessage());
	} catch(HibernateException he) {
		logger.info("HibernateException " + he.getMessage());
	} catch(NullPointerException npe) {
		logger.info("NullPointerException " + npe.getMessage());
	}
	return pkValue;
}
 
开发者ID:GovernIB,项目名称:helium,代码行数:17,代码来源:EntityParser.java


示例6: getGetter

import org.hibernate.PropertyNotFoundException; //导入依赖的package包/类
/**
 * Create a "getter" for the named attribute
 */
public Getter getGetter(Class theClass, String propertyName) 
throws PropertyNotFoundException {
	if (nodeName==null) {
		throw new MappingException("no node name for property: " + propertyName);
	}
	if ( ".".equals(nodeName) ) {
		return new TextGetter(propertyType, factory);
	}
	else if ( nodeName.indexOf('/')>-1 ) {
		return new ElementAttributeGetter(nodeName, propertyType, factory);
	}
	else if ( nodeName.indexOf('@')>-1 ) {
		return new AttributeGetter(nodeName, propertyType, factory);
	}
	else {
		return new ElementGetter(nodeName, propertyType, factory);
	}
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:22,代码来源:Dom4jAccessor.java


示例7: getSetter

import org.hibernate.PropertyNotFoundException; //导入依赖的package包/类
/**
 * Create a "setter" for the named attribute
 */
public Setter getSetter(Class theClass, String propertyName) 
throws PropertyNotFoundException {
	if (nodeName==null) {
		throw new MappingException("no node name for property: " + propertyName);
	}
	if ( ".".equals(nodeName) ) {
		return new TextSetter(propertyType);
	}
	else if ( nodeName.indexOf('/')>-1 ) {
		return new ElementAttributeSetter(nodeName, propertyType);
	}
	else if ( nodeName.indexOf('@')>-1 ) {
		return new AttributeSetter(nodeName, propertyType);
	}
	else {
		return new ElementSetter(nodeName, propertyType);
	}
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:22,代码来源:Dom4jAccessor.java


示例8: PojoInstantiator

import org.hibernate.PropertyNotFoundException; //导入依赖的package包/类
public PojoInstantiator(Component component, ReflectionOptimizer.InstantiationOptimizer optimizer) {
	this.mappedClass = component.getComponentClass();
	this.optimizer = optimizer;

	this.proxyInterface = null;
	this.embeddedIdentifier = false;

	try {
		constructor = ReflectHelper.getDefaultConstructor(mappedClass);
	}
	catch ( PropertyNotFoundException pnfe ) {
		log.info(
		        "no default (no-argument) constructor for class: " +
				mappedClass.getName() +
				" (class must be instantiated by Interceptor)"
		);
		constructor = null;
	}
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:20,代码来源:PojoInstantiator.java


示例9: getDefaultConstructor

import org.hibernate.PropertyNotFoundException; //导入依赖的package包/类
public static Constructor getDefaultConstructor(Class clazz) throws PropertyNotFoundException {

		if ( isAbstractClass(clazz) ) return null;

		try {
			Constructor constructor = clazz.getDeclaredConstructor(NO_CLASSES);
			if ( !isPublic(clazz, constructor) ) {
				constructor.setAccessible(true);
			}
			return constructor;
		}
		catch (NoSuchMethodException nme) {
			throw new PropertyNotFoundException(
				"Object class " + clazz.getName() +
				" must declare a default (no-argument) constructor"
			);
		}

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


示例10: getConstructor

import org.hibernate.PropertyNotFoundException; //导入依赖的package包/类
public static Constructor getConstructor(Class clazz, Type[] types) throws PropertyNotFoundException {
	final Constructor[] candidates = clazz.getConstructors();
	for ( int i=0; i<candidates.length; i++ ) {
		final Constructor constructor = candidates[i];
		final Class[] params = constructor.getParameterTypes();
		if ( params.length==types.length ) {
			boolean found = true;
			for ( int j=0; j<params.length; j++ ) {
				final boolean ok = params[j].isAssignableFrom( types[j].getReturnedClass() ) || (
					types[j] instanceof PrimitiveType &&
					params[j] == ( (PrimitiveType) types[j] ).getPrimitiveClass()
				);
				if (!ok) {
					found = false;
					break;
				}
			}
			if (found) {
				if ( !isPublic(clazz, constructor) ) constructor.setAccessible(true);
				return constructor;
			}
		}
	}
	throw new PropertyNotFoundException( "no appropriate constructor in class: " + clazz.getName() );
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:26,代码来源:ReflectHelper.java


示例11: getDefaultConstructor

import org.hibernate.PropertyNotFoundException; //导入依赖的package包/类
/**
 * Retrieve the default (no arg) constructor from the given class.
 *
 * @param clazz The class for which to retrieve the default ctor.
 * @return The default constructor.
 * @throws PropertyNotFoundException Indicates there was not publicly accessible, no-arg constructor (todo : why PropertyNotFoundException???)
 */
public static Constructor getDefaultConstructor(Class clazz) throws PropertyNotFoundException {
	if ( isAbstractClass( clazz ) ) {
		return null;
	}

	try {
		Constructor constructor = clazz.getDeclaredConstructor( NO_PARAM_SIGNATURE );
		if ( !isPublic( clazz, constructor ) ) {
			constructor.setAccessible( true );
		}
		return constructor;
	}
	catch ( NoSuchMethodException nme ) {
		throw new PropertyNotFoundException(
				"Object class [" + clazz.getName() + "] must declare a default (no-argument) constructor"
		);
	}
}
 
开发者ID:niaoge,项目名称:spring-dynamic,代码行数:26,代码来源:ReflectHelper.java


示例12: globalErrorHandler

import org.hibernate.PropertyNotFoundException; //导入依赖的package包/类
@ExceptionHandler(value = 
		{
		Exception.class, 
		NullPointerException.class,
	    NoSuchRequestHandlingMethodException.class, 
	    RuntimeException.class,
	    ResourceAccessException.class,
	    AccessDeniedException.class,
	    PropertyNotFoundException.class,
	    ConstraintViolationException.class,
	    NestedServletException.class}
		)

// Don't pass model object here. Seriously was creating issues here.
   public ModelAndView globalErrorHandler(HttpServletRequest request, Exception e) {
           System.out.println("comes in exception controller");
           ModelAndView mdlViewObj = new ModelAndView("/common/Exception");
           logger.error(e.getStackTrace());
           return mdlViewObj;
           //return new ModelAndView("common/Exception"); // Error java.lang.IllegalStateException: No suitable resolver for argument [0] [type=org.springframework.ui.ModelMap]
}
 
开发者ID:rsubra13,项目名称:ss,代码行数:22,代码来源:IraBankExceptionController.java


示例13: createSetter

import org.hibernate.PropertyNotFoundException; //导入依赖的package包/类
private static Setter createSetter(Class theClass, String propertyName) throws PropertyNotFoundException {
	BasicSetter result = getSetterOrNull(theClass, propertyName);
	if (result==null) {
		throw new PropertyNotFoundException(
				"Could not find a setter for property " +
				propertyName +
				" in class " +
				theClass.getName()
			);
	}
	return result;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:BasicPropertyAccessor.java


示例14: createGetter

import org.hibernate.PropertyNotFoundException; //导入依赖的package包/类
public static Getter createGetter(Class theClass, String propertyName) throws PropertyNotFoundException {
	BasicGetter result = getGetterOrNull(theClass, propertyName);
	if (result==null) {
		throw new PropertyNotFoundException(
				"Could not find a getter for " +
				propertyName +
				" in class " +
				theClass.getName()
		);
	}
	return result;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:13,代码来源:BasicPropertyAccessor.java


示例15: getField

import org.hibernate.PropertyNotFoundException; //导入依赖的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 );
	}
	field.setAccessible(true);
	return field;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:DirectPropertyAccessor.java


示例16: getGetter

import org.hibernate.PropertyNotFoundException; //导入依赖的package包/类
public Getter getGetter(Class theClass, String propertyName)
		throws PropertyNotFoundException {
	Getter result = null;
	for (int i = 0; i < chain.length; i++) {
		PropertyAccessor candidate = chain[i];
		try {
			result = candidate.getGetter(theClass, propertyName);
			return result;
		} catch (PropertyNotFoundException pnfe) {
			// ignore
		}
	}
	throw new PropertyNotFoundException("Could not find getter for " + propertyName + " on " + theClass);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:ChainedPropertyAccessor.java


示例17: getSetter

import org.hibernate.PropertyNotFoundException; //导入依赖的package包/类
public Setter getSetter(Class theClass, String propertyName)
		throws PropertyNotFoundException {
	Setter result = null;
	for (int i = 0; i < chain.length; i++) {
		PropertyAccessor candidate = chain[i];
		try {
			result = candidate.getSetter(theClass, propertyName);
			return result;
		} catch (PropertyNotFoundException pnfe) {
			//
		}
	}
	throw new PropertyNotFoundException("Could not find setter for " + propertyName + " on " + theClass);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:ChainedPropertyAccessor.java


示例18: getter

import org.hibernate.PropertyNotFoundException; //导入依赖的package包/类
private static Getter getter(Class clazz, String name) throws MappingException {
	try {
		return BASIC_PROPERTY_ACCESSOR.getGetter( clazz, name );
	}
	catch ( PropertyNotFoundException pnfe ) {
		return DIRECT_PROPERTY_ACCESSOR.getGetter( clazz, name );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:9,代码来源:ReflectHelper.java


示例19: getPropertyIndex

import org.hibernate.PropertyNotFoundException; //导入依赖的package包/类
public int getPropertyIndex(String name) {
	String[] names = getPropertyNames();
	for ( int i = 0, max = names.length; i < max; i++ ) {
		if ( names[i].equals( name ) ) {
			return i;
		}
	}
	throw new PropertyNotFoundException(
			"Unable to locate property named " + name + " on " + getReturnedClass().getName()
	);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:12,代码来源:ComponentType.java


示例20: createSetter

import org.hibernate.PropertyNotFoundException; //导入依赖的package包/类
private static Setter createSetter(Class theClass, String propertyName) 
throws PropertyNotFoundException {
	BasicSetter result = getSetterOrNull(theClass, propertyName);
	if (result==null) {
		throw new PropertyNotFoundException( 
				"Could not find a setter for property " + 
				propertyName + 
				" in class " + 
				theClass.getName() 
			);
	}
	return result;
}
 
开发者ID:cacheonix,项目名称:cacheonix-core,代码行数:14,代码来源:BasicPropertyAccessor.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Content类代码示例发布时间:2022-05-22
下一篇:
Java TransitionSet类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap