@Override protected ManagedType<E> locateManagedType() { return isBasicCollection() ? null : (ManagedType<E>) getAttribute().getElementType(); }
public boolean isBasicCollection() { return Type.PersistenceType.BASIC.equals( getAttribute().getElementType().getPersistenceType() ); }
@Override @SuppressWarnings("unchecked") protected ManagedType<? super X> locateManagedType() { if ( getModel().getBindableType() == Bindable.BindableType.ENTITY_TYPE ) { return (ManagedType<? super X>) getModel(); } else if ( getModel().getBindableType() == Bindable.BindableType.SINGULAR_ATTRIBUTE ) { final Type joinedAttributeType = ( (SingularAttribute) getAttribute() ).getType(); if ( !ManagedType.class.isInstance( joinedAttributeType ) ) { throw new UnsupportedOperationException( "Cannot further dereference attribute join [" + getPathIdentifier() + "] as its type is not a ManagedType" ); } return (ManagedType<? super X>) joinedAttributeType; } else if ( getModel().getBindableType() == Bindable.BindableType.PLURAL_ATTRIBUTE ) { final Type elementType = ( (PluralAttribute) getAttribute() ).getElementType(); if ( !ManagedType.class.isInstance( elementType ) ) { throw new UnsupportedOperationException( "Cannot further dereference attribute join [" + getPathIdentifier() + "] (plural) as its element type is not a ManagedType" ); } return (ManagedType<? super X>) elementType; } return super.locateManagedType(); }
toAttrJoinType = parentJoinAttr.getJavaType(); } else if( parentJoinAttr instanceof PluralAttribute ) { toAttrJoinType = ((PluralAttribute) parentJoinAttr).getElementType().getJavaType(); } else { String joinName = parentJoinAttr.getDeclaringType().getJavaType().getSimpleName() + "." + parentJoinAttr.getName();
/** * Assert on owner type attributes. * * @param managedType * the managed type * @param fieldName * the field name * @param fieldClazz * the field clazz * @param javaClazz * the java clazz */ private void assertOnOwnerTypeAttributes(AbstractManagedType managedType, String fieldName, Class fieldClazz, Class javaClazz) { Assert.assertNotNull(managedType); Assert.assertNotNull(managedType.getPluralAttributes()); Assert.assertEquals(4, managedType.getPluralAttributes().size()); Assert.assertNotNull(managedType.getAttribute(fieldName)); Assert.assertEquals(javaClazz, managedType.getAttribute(fieldName).getJavaType()); Assert.assertEquals(fieldClazz, ((PluralAttribute) managedType.getAttribute(fieldName)).getElementType() .getJavaType()); Assert.assertEquals(BindableType.PLURAL_ATTRIBUTE, ((PluralAttribute) managedType.getAttribute(fieldName)).getBindableType()); Assert.assertNotNull(((PluralAttribute) managedType.getAttribute(fieldName)).getJavaMember()); Assert.assertNotNull(fieldName, ((PluralAttribute) managedType.getAttribute(fieldName)).getJavaMember() .getName()); }
public boolean selects(Attribute<? super X, ?> attr) { boolean result = (attr instanceof PluralAttribute<?, ?, ?>) && (_elementType == null || ((PluralAttribute<?, ?, ?>) attr).getElementType().getJavaType() == _elementType); return _invert ? !result : result; }
public boolean selects(Attribute<? super X, ?> attr) { boolean result = (attr instanceof PluralAttribute<?, ?, ?>) && (_elementType == null || ((PluralAttribute<?, ?, ?>) attr).getElementType().getJavaType() == _elementType); return _invert ? !result : result; }
public boolean selects(Attribute<? super X, ?> attr) { boolean result = (attr instanceof PluralAttribute<?, ?, ?>) && (_elementType == null || ((PluralAttribute<?, ?, ?>) attr).getElementType().getJavaType() == _elementType); return _invert ? !result : result; }
public boolean selects(Attribute<? super X, ?> attr) { boolean result = (attr instanceof PluralAttribute<?, ?, ?>) && (_elementType == null || ((PluralAttribute<?, ?, ?>) attr).getElementType().getJavaType() == _elementType); return _invert ? !result : result; }
IntermediateStructuredType getStructuredType(final PluralAttribute<?, ?, ?> jpaAttribute) { IntermediateStructuredType type = complexTypeListInternalKey.get(IntNameBuilder.buildStructuredTypeName(jpaAttribute .getElementType().getJavaType())); if (type == null) type = entityTypeListInternalKey.get(IntNameBuilder.buildStructuredTypeName(jpaAttribute.getElementType() .getJavaType())); return type; }
private static <E> Class<?> getJavaType(Attribute<? super E, ?> attribute) { return (attribute instanceof PluralAttribute) ? ((PluralAttribute<?, ?, ?>) attribute).getElementType().getJavaType() : attribute.getJavaType(); }
@Override @SuppressWarnings("unchecked") protected ManagedType<E> getManagedType() { if (treatJoinType != null) { return (ManagedType<E>) treatJoinType; } return isBasicCollection() ? null : (ManagedType<E>) getAttribute().getElementType(); }
@Override protected ManagedType<E> locateManagedType() { return isBasicCollection() ? null : (ManagedType<E>) getAttribute().getElementType(); }
@Override @SuppressWarnings("unchecked") protected ManagedType<E> getManagedType() { if (treatJoinType != null) { return (ManagedType<E>) treatJoinType; } return isBasicCollection() ? null : (ManagedType<E>) getAttribute().getElementType(); }
/** * Resolve Java type from associated query argument JPA model attribute * * @param environment * @param argument * @return Java class type */ protected Class<?> getJavaType(DataFetchingEnvironment environment, Argument argument) { Attribute<?,?> argumentEntityAttribute = getAttribute(environment, argument); if (argumentEntityAttribute instanceof PluralAttribute) return ((PluralAttribute<?,?,?>) argumentEntityAttribute).getElementType().getJavaType(); return argumentEntityAttribute.getJavaType(); }
public boolean isBasicCollection() { return Type.PersistenceType.BASIC.equals( getAttribute().getElementType().getPersistenceType() ); }
public boolean isBasicCollection() { return Type.PersistenceType.BASIC.equals(getAttribute().getElementType().getPersistenceType()); }
@Override public boolean isBasicCollection() { return Type.PersistenceType.BASIC.equals(this.getAttribute().getElementType().getPersistenceType()); }
@Override public boolean isCompositeNode(Attribute<?, ?> attr) { if (attr.isCollection()) { PluralAttribute<?, ?, ?> pluralAttribute = (PluralAttribute<?, ?, ?>) attr; if (pluralAttribute.getElementType().getPersistenceType() == Type.PersistenceType.BASIC) { return false; } return true; } return attr.getPersistentAttributeType() == Attribute.PersistentAttributeType.MANY_TO_ONE || attr.getPersistentAttributeType() == Attribute.PersistentAttributeType.ONE_TO_ONE; }
@Override public boolean isCompositeNode(Attribute<?, ?> attr) { if (attr.isCollection()) { PluralAttribute<?, ?, ?> pluralAttribute = (PluralAttribute<?, ?, ?>) attr; if (pluralAttribute.getElementType().getPersistenceType() == Type.PersistenceType.BASIC) { return false; } return true; } return attr.getPersistentAttributeType() == Attribute.PersistentAttributeType.MANY_TO_ONE || attr.getPersistentAttributeType() == Attribute.PersistentAttributeType.ONE_TO_ONE; }