|| attribute.getDeclaringType().getPersistenceType() == Type.PersistenceType.EMBEDDABLE;
@SuppressWarnings("unchecked") public static <T> Expression defaultGetEntityField(CriteriaQuery<T> query, String listId, Attribute attr) { Expression entityField = null; if( attr != null ) { Class attrType = attr.getDeclaringType().getJavaType(); for( From from : query.getRoots() ) { if( from.getJavaType().equals(attrType) ) { if( attr != null ) { if( attr instanceof SingularAttribute ) { entityField = from.get((SingularAttribute) attr); } else if( attr instanceof PluralAttribute ) { entityField = from.get((PluralAttribute) attr); } else { throw new IllegalStateException("Unexpected attribute type when processing criteria with list id " + listId + ": " + attr.getClass().getName() ); } break; } } } } // if entityField == null, this is because this QueryCriteria is a implementation specific criteria, such as "LAST_VARIABLE_LIST" return entityField; }
taskDataJoin = taskRoot.join(TaskImpl_.taskData); Class attrType = attr.getDeclaringType().getJavaType(); From [] taskRoots = { taskRoot, taskDataJoin }; for( From from : taskRoots ) {
private String [] createOriginalAndExpectedKeys(Attribute embeddedAttr, PluralAttribute listAttr) { String originalKey = embeddedAttr.getDeclaringType().getJavaType().getName() + "." + embeddedAttr.getName() + "." + listAttr.getName(); String copyKey = listAttr.getDeclaringType().getJavaType().getName() + "." + listAttr.getName(); String [] keys = { originalKey, copyKey }; return keys; }
toAttrJoinType = ((PluralAttribute) parentJoinAttr).getElementType().getJavaType(); } else { String joinName = parentJoinAttr.getDeclaringType().getJavaType().getSimpleName() + "." + parentJoinAttr.getName(); throw new IllegalStateException("Unknown attribute type encountered when trying to join " + joinName );
private <Y> Path<Y> getPath(Attribute attribute,EntityType<Y> entityType,Attribute embeddedAttribute) { Path<Y> path = null; if (attribute.isCollection()) { path = new DefaultPath<Y>(PathType.PLURAL, attribute.getDeclaringType(), attribute, entityType,embeddedAttribute); } else { path = new DefaultPath<Y>(PathType.SINGULAR, attribute.getDeclaringType(), attribute,entityType,embeddedAttribute); } return path; }
public boolean selects(Attribute<? super X, ?> attr) { return _invert ? attr.getDeclaringType() != owner : attr .getDeclaringType() == owner; }
public boolean selects(Attribute<? super X, ?> attr) { return _invert ? attr.getDeclaringType() != owner : attr .getDeclaringType() == owner; }
public boolean selects(Attribute<? super X, ?> attr) { return _invert ? attr.getDeclaringType() != owner : attr .getDeclaringType() == owner; }
public boolean selects(Attribute<? super X, ?> attr) { return _invert ? attr.getDeclaringType() != owner : attr .getDeclaringType() == owner; }
public ManagedType<E> getDeclaringType() { return this.raw.getDeclaringType(); }
Assert.assertEquals(AssociationBiEntity.class, associationAttribute.getJavaType()); Assert.assertEquals(true, associationAttribute.isAssociation()); Assert.assertEquals(OToOOwnerBiEntity.class, associationAttribute.getDeclaringType().getJavaType()); Assert.assertEquals("association", associationAttribute.getName()); Assert.assertEquals(OToOOwnerBiEntity.class, ownerAttribute.getJavaType()); Assert.assertEquals(true, ownerAttribute.isAssociation()); Assert.assertEquals(AssociationBiEntity.class, ownerAttribute.getDeclaringType().getJavaType()); Assert.assertEquals("owner", ownerAttribute.getName()); Assert.assertEquals(managedTypes.get(AssociationBiEntity.class), ownerAttribute.getDeclaringType()); Assert.assertEquals(AssociationBiEntity.class, ownerAttribute.getJavaMember().getDeclaringClass()); Assert.assertEquals(OToOOwnerBiEntity.class, ownerAttribute.getJavaType());
Assert.assertEquals(AssociationEntity.class, associationAttribute.getJavaType()); Assert.assertEquals(true, associationAttribute.isAssociation()); Assert.assertEquals(OToOOwnerEntity.class, associationAttribute.getDeclaringType().getJavaType()); Assert.assertEquals("association", associationAttribute.getName());
Assert.assertEquals(AssociationEntity.class, ((Bindable) associationAttribute).getBindableJavaType()); Assert.assertEquals(true, associationAttribute.isAssociation()); Assert.assertEquals(OToMOwnerEntity.class, associationAttribute.getDeclaringType().getJavaType()); Assert.assertEquals("association", associationAttribute.getName());
@Override public ManagedType<X> getDeclaringType() { return getAttribute().getDeclaringType(); }
public void verifyPath(Attribute<?, ?>... path) { List<Attribute<?, ?>> attributes = newArrayList(path); Class<?> from = attributes.get(0).getJavaType(); attributes.remove(0); for (Attribute<?, ?> attribute : attributes) { if (!attribute.getDeclaringType().getJavaType().isAssignableFrom(from)) { throw new IllegalStateException("Wrong path."); } from = attribute.getJavaType(); } }
public IntermediateProperty(final JPAEdmNameBuilder nameBuilder, final Attribute<?, ?> jpaAttribute, final IntermediateSchema schema) throws ODataJPAModelException { super(nameBuilder, IntNameBuilder.buildAttributeName(jpaAttribute)); this.jpaAttribute = jpaAttribute; this.schema = schema; this.managedType = jpaAttribute.getDeclaringType(); buildProperty(nameBuilder); }
public PathHolder(List<Attribute<?, ?>> attributes) { JpaUtil.getInstance().verifyPath(checkNotNull(attributes)); this.attributes = newArrayList(attributes); this.path = MetamodelUtil.getInstance().toPath(attributes); this.from = attributes.get(0).getDeclaringType().getJavaType(); }
public static JPAMember create(Attribute<?, ?> jpaAttribute, Object target) { Member javaMember = jpaAttribute.getJavaMember(); if (javaMember instanceof Field) return new FieldMember((Field) javaMember, target); if (javaMember instanceof Method) return new GetterSetterMember((Method) javaMember, null, target); // http://wiki.eclipse.org/EclipseLink/Development/JPA_2.0/metamodel_api#DI_95:_20091017:_Attribute.getJavaMember.28.29_returns_null_for_a_BasicType_on_a_MappedSuperclass_because_of_an_uninitialized_accessor JPAMember rt = reverseEngineerJPAMember(jpaAttribute.getDeclaringType().getJavaType(), jpaAttribute.getName(), target); if (rt == null) throw new IllegalArgumentException("Could not find java member for: " + jpaAttribute); return rt; }
/** * {@inheritDoc} * */ @Override protected void addAttributes(ManagedTypeMetadata entityMetadata) { if (this.supertype != null) { for (Attribute<? super X, ?> attribute : this.supertype.getAttributes()) { if ((attribute.getDeclaringType() instanceof MappedSuperclassTypeImpl) && (this instanceof EntityTypeImpl)) { attribute = ((AttributeImpl<? super X, ?>) attribute).clone((EntityTypeImpl<X>) this); } this.addAttribute((AttributeImpl<? super X, ?>) attribute); } } super.addAttributes(entityMetadata); }