Package javax.persistence.metamodel

Examples of javax.persistence.metamodel.Attribute


   * @return The attribute; should never return null.
   *
   * @throws IllegalArgumentException If no such attribute exists
   */
  protected  final Attribute locateAttribute(String attributeName) {
    final Attribute attribute = locateAttributeInternal( attributeName );
    if ( attribute == null ) {
      throw unknownAttribute( attributeName );
    }
    return attribute;
  }
View Full Code Here


            }
            if ( safeMapping.isVersioned() && property == safeMapping.getVersion() ) {
              // skip the version property, it was already handled previously.
              continue;
            }
            final Attribute attribute = attributeFactory.buildAttribute( jpa2Mapping, property );
            if ( attribute != null ) {
              jpa2Mapping.getBuilder().addAttribute( attribute );
            }
          }
          jpa2Mapping.lock();
          populateStaticMetamodel( jpa2Mapping );
        }
        finally {
                    LOG.trace("Completed entity [" + safeMapping.getEntityName() + "]");
        }
      }
      else if ( MappedSuperclass.class.isAssignableFrom( mapping.getClass() ) ) {
        @SuppressWarnings( "unchecked" )
        final MappedSuperclass safeMapping = (MappedSuperclass) mapping;
                LOG.trace("Starting mapped superclass [" + safeMapping.getMappedClass().getName() + "]");
        try {
          final MappedSuperclassTypeImpl<?> jpa2Mapping = mappedSuperclassByMappedSuperclassMapping.get(
              safeMapping
          );
          applyIdMetadata( safeMapping, jpa2Mapping );
          applyVersionAttribute( safeMapping, jpa2Mapping );
          Iterator<Property> properties = safeMapping.getDeclaredPropertyIterator();
          while ( properties.hasNext() ) {
            final Property property = properties.next();
            if ( safeMapping.isVersioned() && property == safeMapping.getVersion() ) {
              // skip the version property, it was already handled previously.
              continue;
            }
            final Attribute attribute = attributeFactory.buildAttribute( jpa2Mapping, property );
            if ( attribute != null ) {
              jpa2Mapping.getBuilder().addAttribute( attribute );
            }
          }
          jpa2Mapping.lock();
View Full Code Here

  public <Y> Path<Y> get(String attributeName) {
    if ( ! canBeDereferenced() ) {
      throw illegalDereference();
    }

    final Attribute attribute = locateAttribute( attributeName );

    if ( attribute.isCollection() ) {
      final PluralAttribute<X,Y,?> pluralAttribute = (PluralAttribute<X,Y,?>) attribute;
      if ( PluralAttribute.CollectionType.MAP.equals( pluralAttribute.getCollectionType() ) ) {
        return (PluralAttributePath<Y>) this.<Object,Object,Map<Object, Object>>get( (MapAttribute) pluralAttribute );
      }
      else {
View Full Code Here

   * @return The attribute; should never return null.
   *
   * @throws IllegalArgumentException If no such attribute exists
   */
  protected  final Attribute locateAttribute(String attributeName) {
    final Attribute attribute = locateAttributeInternal( attributeName );
    if ( attribute == null ) {
      throw unknownAttribute( attributeName );
    }
    return attribute;
  }
View Full Code Here

         *     attribute not found && no superType exists = false
         *   Recursive Case
         *     Exit(false) as soon as attribute is found in a superType - without continuing to the root
         *     continue as long as we find an attribute in the superType (essentially only MappedSuperclass parents)         
         **/
        Attribute anAttribute = this.getMembers().get(attributeName);
        ManagedTypeImpl<?> aSuperType = getManagedSuperType();       
       
        // Base Case: If we are at the root, check for the attribute and return results immediately
        if(null == aSuperType) { // 315287: the superType will be null if the root is a BasicType (non-Entity|non-MappedSuperclass)
            if(null == anAttribute && null != firstLevelAttribute) {
                return true;
            } else {
                // UC 1.3 (part of the else condition (anAttribute != null)) is handled by the return false in null != aSuperTypeAttribute
                // UC 1.4 (when caller is firstLevel) superType does not contain the attribute - check that the current attribute and the first differ
                if(null != anAttribute && anAttribute == firstLevelAttribute) {
                    return true;
                } else {
                    return false;
                }
            }
        } else {           
           // Recursive Case: check hierarchy both if the immediate superclass is a MappedSuperclassType or EntityType
           Attribute aSuperTypeAttribute = aSuperType.getMembers().get(attributeName);
           // UC1.3 The immediate mappedSuperclass may have the attribute - we check it in the base case of the next recursive call
           if(null != aSuperTypeAttribute) {
               // return false immediately if a superType exists above the first level
               return false;
           } else {
View Full Code Here

         *     attribute not found && no superType exists = false
         *   Recursive Case
         *     Exit(false) as soon as attribute is found in a superType - without continuing to the root
         *     continue as long as we find an attribute in the superType (essentially only MappedSuperclass parents)         
         **/
        Attribute anAttribute = this.getMembers().get(attributeName);
        ManagedTypeImpl<?> aSuperType = getManagedSuperType();       
       
        // Base Case: If we are at the root, check for the attribute and return results immediately
        if(null == aSuperType) { // 315287: the superType will be null if the root is a BasicType (non-Entity|non-MappedSuperclass)
            if(null == anAttribute && null != firstLevelAttribute) {
                return true;
            } else {
                // UC 1.3 (part of the else condition (anAttribute != null)) is handled by the return false in null != aSuperTypeAttribute
                // UC 1.4 (when caller is firstLevel) superType does not contain the attribute - check that the current attribute and the first differ
                if(null != anAttribute && anAttribute == firstLevelAttribute) {
                    return true;
                } else {
                    return false;
                }
            }
        } else {           
           // Recursive Case: check hierarchy both if the immediate superclass is a MappedSuperclassType or EntityType
           Attribute aSuperTypeAttribute = aSuperType.getMembers().get(attributeName);
           // UC1.3 The immediate mappedSuperclass may have the attribute - we check it in the base case of the next recursive call
           if(null != aSuperTypeAttribute) {
               // return false immediately if a superType exists above the first level
               return false;
           } else {
View Full Code Here

         *     attribute not found && no superType exists = false
         *   Recursive Case
         *     Exit(false) as soon as attribute is found in a superType - without continuing to the root
         *     continue as long as we find an attribute in the superType (essentially only MappedSuperclass parents)         
         **/
        Attribute anAttribute = this.getMembers().get(attributeName);
        ManagedTypeImpl<?> aSuperType = getManagedSuperType();       
       
        // Base Case: If we are at the root, check for the attribute and return results immediately
        if(null == aSuperType) { // 315287: the superType will be null if the root is a BasicType (non-Entity|non-MappedSuperclass)
            if(null == anAttribute && null != firstLevelAttribute) {
                return true;
            } else {
                // UC 1.3 (part of the else condition (anAttribute != null)) is handled by the return false in null != aSuperTypeAttribute
                // UC 1.4 (when caller is firstLevel) superType does not contain the attribute - check that the current attribute and the first differ
                if(null != anAttribute && anAttribute == firstLevelAttribute) {
                    return true;
                } else {
                    return false;
                }
            }
        } else {           
           // Recursive Case: check hierarchy both if the immediate superclass is a MappedSuperclassType or EntityType
           Attribute aSuperTypeAttribute = aSuperType.getMembers().get(attributeName);
           // UC1.3 The immediate mappedSuperclass may have the attribute - we check it in the base case of the next recursive call
           if(null != aSuperTypeAttribute) {
               // return false immediately if a superType exists above the first level
               return false;
           } else {
View Full Code Here

  public <Y> Path<Y> get(String attributeName) {
    if ( ! canBeDereferenced() ) {
      throw illegalDereference();
    }

    final Attribute attribute = locateAttribute( attributeName );

    if ( attribute.isCollection() ) {
      final PluralAttribute<X,Y,?> pluralAttribute = (PluralAttribute<X,Y,?>) attribute;
      if ( PluralAttribute.CollectionType.MAP.equals( pluralAttribute.getCollectionType() ) ) {
        return (PluralAttributePath<Y>) this.<Object,Object,Map<Object, Object>>get( (MapAttribute) pluralAttribute );
      }
      else {
View Full Code Here

   * @return The attribute; should never return null.
   *
   * @throws IllegalArgumentException If no such attribute exists
   */
  protected  final Attribute locateAttribute(String attributeName) {
    final Attribute attribute = locateAttributeInternal( attributeName );
    if ( attribute == null ) {
      throw unknownAttribute( attributeName );
    }
    return attribute;
  }
View Full Code Here

    return managedType != null;
  }

  @Override
  protected Attribute locateAttributeInternal(String attributeName) {
    final Attribute attribute = managedType.getAttribute( attributeName );
    // ManagedType.locateAttribute should throw exception rather than return
    // null, but just to be safe...
    if ( attribute == null ) {
      throw new IllegalArgumentException( "Could not resolve attribute named " + attributeName );
    }
View Full Code Here

TOP

Related Classes of javax.persistence.metamodel.Attribute

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.