本文整理了Java中org.hibernate.annotations.common.reflection.XProperty.getCollectionClass()
方法的一些代码示例,展示了XProperty.getCollectionClass()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XProperty.getCollectionClass()
方法的具体详情如下:
包路径:org.hibernate.annotations.common.reflection.XProperty
类名称:XProperty
方法名:getCollectionClass
暂无
代码示例来源:origin: hibernate/hibernate-orm
private void validateLobMappingSupport(XProperty property) {
// HHH-9834 - Sanity check
try {
if ( property.isAnnotationPresent( ElementCollection.class ) ) {
if ( property.isAnnotationPresent( Lob.class ) ) {
if ( !property.getCollectionClass().isAssignableFrom( Map.class ) ) {
throw new MappingException(
"@ElementCollection combined with @Lob is only supported for Map collection types."
);
}
}
}
}
catch ( MappingException e ) {
throw new HibernateException(
String.format(
"Invalid mapping in [%s] for property [%s]",
property.getDeclaringClass().getName(),
property.getName()
),
e
);
}
}
代码示例来源:origin: hibernate/hibernate-orm
final Class<?> returnedClass = property.getCollectionClass();
代码示例来源:origin: org.hibernate/hibernate-annotations
Class returnedClass = property.getCollectionClass();
if ( java.util.Set.class.equals( returnedClass ) ) {
if ( property.isAnnotationPresent( CollectionId.class ) ) {
代码示例来源:origin: org.hibernate.orm/hibernate-core
private void validateLobMappingSupport(XProperty property) {
// HHH-9834 - Sanity check
try {
if ( property.isAnnotationPresent( ElementCollection.class ) ) {
if ( property.isAnnotationPresent( Lob.class ) ) {
if ( !property.getCollectionClass().isAssignableFrom( Map.class ) ) {
throw new MappingException(
"@ElementCollection combined with @Lob is only supported for Map collection types."
);
}
}
}
}
catch ( MappingException e ) {
throw new HibernateException(
String.format(
"Invalid mapping in [%s] for property [%s]",
property.getDeclaringClass().getName(),
property.getName()
),
e
);
}
}
代码示例来源:origin: org.hibernate.orm/hibernate-core
final Class<?> returnedClass = property.getCollectionClass();
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate
Class returnedClass = property.getCollectionClass();
if ( java.util.Set.class.equals( returnedClass ) ) {
if ( property.isAnnotationPresent( CollectionId.class ) ) {
代码示例来源:origin: org.hibernate/com.springsource.org.hibernate.core
Class returnedClass = property.getCollectionClass();
if ( java.util.Set.class.equals( returnedClass ) ) {
if ( property.isAnnotationPresent( CollectionId.class ) ) {
代码示例来源:origin: hibernate/hibernate-commons-annotations
public void testCanBeASimpleType() {
List<XProperty> declaredProperties = dadAsSeenFromSon.getDeclaredProperties( "field" );
XProperty p = getPropertyNamed_from( "fieldProperty", declaredProperties );
assertTrue( factory.equals( p.getType(), String.class ) );
assertTrue( factory.equals( p.getElementClass(), String.class ) );
assertTrue( factory.equals( p.getClassOrElementClass(), String.class ) );
assertNull( p.getCollectionClass() );
assertFalse( p.isArray() );
assertFalse( p.isCollection() );
}
代码示例来源:origin: hibernate/hibernate-commons-annotations
public void testResolveInterfaceType() {
List<XProperty> declaredProperties = dadAsSeenFromSon.getDeclaredProperties( "property" );
XProperty p = getPropertyNamed_from( "language", declaredProperties );
assertTrue( factory.equals( p.getType(), String.class ) );
assertTrue( factory.equals( p.getElementClass(), String.class ) );
assertTrue( factory.equals( p.getClassOrElementClass(), String.class ) );
assertNull( p.getCollectionClass() );
assertNull( p.getMapKey() );
assertFalse( p.isArray() );
assertFalse( p.isCollection() );
}
代码示例来源:origin: hibernate/hibernate-commons-annotations
public void testCanBeAnArray() {
List<XProperty> declaredProperties = dadAsSeenFromSon.getDeclaredProperties( "property" );
XProperty p = getPropertyNamed_from( "arrayProperty", declaredProperties );
assertTrue( factory.equals( p.getType(), String[].class ) );
assertTrue( factory.equals( p.getElementClass(), String.class ) );
assertTrue( factory.equals( p.getClassOrElementClass(), String.class ) );
assertNull( p.getCollectionClass() );
assertNull( p.getMapKey() );
assertTrue( p.isArray() );
assertFalse( p.isCollection() );
}
代码示例来源:origin: hibernate/hibernate-commons-annotations
public void testCanBeAnArrayOfPrimitives() {
List<XProperty> declaredProperties = dadAsSeenFromSon.getDeclaredProperties( "property" );
XProperty p = getPropertyNamed_from( "primitiveArrayProperty", declaredProperties );
assertTrue( factory.equals( p.getType(), int[].class ) );
assertTrue( factory.equals( p.getElementClass(), int.class ) );
assertTrue( factory.equals( p.getClassOrElementClass(), int.class ) );
assertNull( p.getCollectionClass() );
assertNull( p.getMapKey() );
assertTrue( p.isArray() );
assertFalse( p.isCollection() );
}
代码示例来源:origin: hibernate/hibernate-commons-annotations
public void testCanBeACollection() {
List<XProperty> declaredProperties = dadAsSeenFromSon.getDeclaredProperties( "property" );
XProperty p = getPropertyNamed_from( "collectionProperty", declaredProperties );
assertTrue( factory.equals( p.getType(), Map.class ) );
assertTrue( factory.equals( p.getElementClass(), String.class ) );
assertTrue( factory.equals( p.getClassOrElementClass(), Map.class ) );
assertTrue( factory.equals( p.getMapKey(), Double.class ) );
assertEquals( Map.class, p.getCollectionClass() );
assertFalse( p.isArray() );
assertTrue( p.isCollection() );
}
内容来源于网络,如有侵权,请联系作者删除!