List of usage examples for org.hibernate.type ListType getElementType
public final Type getElementType(SessionFactoryImplementor factory) throws MappingException
From source file:org.atemsource.atem.impl.hibernate.attributetype.MultiAssociationAttributeType.java
License:Apache License
@Override public boolean canCreate(final PropertyDescriptor propertyDescriptor, final Type attributeType, final SessionFactoryImplementor sessionFactoryImplementor) { if (attributeType instanceof ListType) { ListType listType = (ListType) attributeType; Type elementType = listType.getElementType(sessionFactoryImplementor); return elementType.isEntityType(); } else if (attributeType instanceof SetType) { SetType listType = (SetType) attributeType; Type elementType = listType.getElementType(sessionFactoryImplementor); return elementType.isEntityType(); } else if (attributeType instanceof BagType) { BagType listType = (BagType) attributeType; Type elementType = listType.getElementType(sessionFactoryImplementor); return elementType.isEntityType(); } else {//from w ww . j a v a 2 s . c om return false; } }
From source file:org.atemsource.atem.impl.hibernate.attributetype.MultiCompositionAttributeType.java
License:Apache License
@Override public boolean canCreate(final PropertyDescriptor propertyDescriptor, final Type attributeType, final SessionFactoryImplementor sessionFactoryImplementor) { if (attributeType instanceof ListType) { ListType listType = (ListType) attributeType; Type elementType = listType.getElementType(sessionFactoryImplementor); Association association = propertyDescriptor.getReadMethod().getAnnotation(Association.class); return !elementType.isEntityType() && primitiveTypeFactory.getPrimitiveType(elementType.getReturnedClass()) == null; } else if (attributeType instanceof SetType) { SetType listType = (SetType) attributeType; Type elementType = listType.getElementType(sessionFactoryImplementor); Association association = propertyDescriptor.getReadMethod().getAnnotation(Association.class); return !elementType.isEntityType() && primitiveTypeFactory.getPrimitiveType(elementType.getReturnedClass()) == null; } else if (attributeType instanceof BagType) { BagType listType = (BagType) attributeType; Type elementType = listType.getElementType(sessionFactoryImplementor); Association association = propertyDescriptor.getReadMethod().getAnnotation(Association.class); return !elementType.isEntityType() && primitiveTypeFactory.getPrimitiveType(elementType.getReturnedClass()) == null; } else {/*ww w . j a v a 2s .c o m*/ return false; } }
From source file:org.atemsource.atem.impl.hibernate.attributetype.PrimitiveCollectionAttributeType.java
License:Apache License
@Override public boolean canCreate(PropertyDescriptor propertyDescriptor, Type attributeType, SessionFactoryImplementor sessionFactoryImplementor) { if (attributeType instanceof ListType) { ListType listType = (ListType) attributeType; Type elementType = listType.getElementType(sessionFactoryImplementor); return !elementType.isEntityType(); } else if (attributeType instanceof BagType) { BagType listType = (BagType) attributeType; Type elementType = listType.getElementType(sessionFactoryImplementor); return !elementType.isEntityType(); } else if (attributeType instanceof SetType) { SetType listType = (SetType) attributeType; Type elementType = listType.getElementType(sessionFactoryImplementor); return !elementType.isEntityType(); } else {//from www . ja v a 2s. c o m return false; } }