javax.persistence.Convert#converter ( )源码实例Demo

下面列出了javax.persistence.Convert#converter ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: warpdb   文件: AccessibleProperty.java
@SuppressWarnings("unchecked")
private AttributeConverter<Object, Object> getConverter(AccessibleObject accessible) {
	Convert converter = accessible.getAnnotation(Convert.class);
	if (converter != null) {
		Class<?> converterClass = converter.converter();
		if (!AttributeConverter.class.isAssignableFrom(converterClass)) {
			throw new RuntimeException(
					"Converter class must be AttributeConverter rather than " + converterClass.getName());
		}
		try {
			Constructor<?> cs = converterClass.getDeclaredConstructor();
			cs.setAccessible(true);
			return (AttributeConverter<Object, Object>) cs.newInstance();
		} catch (InstantiationException | IllegalAccessException | NoSuchMethodException | SecurityException
				| InvocationTargetException e) {
			throw new RuntimeException("Cannot instantiate Converter: " + converterClass.getName(), e);
		}
	}
	return null;
}
 
源代码2 项目: lams   文件: AttributeConversionInfo.java
@SuppressWarnings("unchecked")
public AttributeConversionInfo(Convert convertAnnotation, XAnnotatedElement xAnnotatedElement) {
	this(
			convertAnnotation.converter(),
			convertAnnotation.disableConversion(),
			convertAnnotation.attributeName(),
			xAnnotatedElement
	);
}
 
 方法所在类
 同类方法