Package javax.persistence

Examples of javax.persistence.Convert


      // not sure this is valid condition
      return;
    }

    {
      final Convert convertAnnotation = collectionProperty.getAnnotation( Convert.class );
      if ( convertAnnotation != null ) {
        applyLocalConvert( convertAnnotation, collectionProperty, elementAttributeConversionInfoMap, keyAttributeConversionInfoMap );
      }
    }
View Full Code Here


    // from the Embedded

    // first apply conversions from the Embeddable...
    {
      // @Convert annotation on the Embeddable class level
      final Convert convertAnnotation = embeddableXClass.getAnnotation( Convert.class );
      if ( convertAnnotation != null ) {
        final AttributeConversionInfo info = new AttributeConversionInfo( convertAnnotation, embeddableXClass );
        if ( StringHelper.isEmpty( info.getAttributeName() ) ) {
          throw new IllegalStateException( "@Convert placed on @Embeddable must define attributeName" );
        }
        infoMap.put( info.getAttributeName(), info );
      }
    }
    {
      // @Converts annotation on the Embeddable class level
      final Converts convertsAnnotation = embeddableXClass.getAnnotation( Converts.class );
      if ( convertsAnnotation != null ) {
        for ( Convert convertAnnotation : convertsAnnotation.value() ) {
          final AttributeConversionInfo info = new AttributeConversionInfo( convertAnnotation, embeddableXClass );
          if ( StringHelper.isEmpty( info.getAttributeName() ) ) {
            throw new IllegalStateException( "@Converts placed on @Embeddable must define attributeName" );
          }
          infoMap.put( info.getAttributeName(), info );
        }
      }
    }

    // then we can overlay any conversions from the Embedded attribute
    {
      // @Convert annotation on the Embedded attribute
      final Convert convertAnnotation = embeddedXProperty.getAnnotation( Convert.class );
      if ( convertAnnotation != null ) {
        final AttributeConversionInfo info = new AttributeConversionInfo( convertAnnotation, embeddableXClass );
        if ( StringHelper.isEmpty( info.getAttributeName() ) ) {
          throw new IllegalStateException( "Convert placed on Embedded attribute must define (sub)attributeName" );
        }
View Full Code Here

      return;
    }

    {
      // @Convert annotation on the Embeddable attribute
      final Convert convertAnnotation = property.getAnnotation( Convert.class );
      if ( convertAnnotation != null ) {
        final AttributeConversionInfo info = new AttributeConversionInfo( convertAnnotation, property );
        attributeConversionInfoMap.put( property.getName(), info );
      }
    }
View Full Code Here

        && ! property.isAnnotationPresent( Temporal.class )
        && ! property.isAnnotationPresent( Enumerated.class );

    if ( canBeConverted ) {
      // @Convert annotations take precedence
      final Convert convertAnnotation = locateConvertAnnotation( property );
      if ( convertAnnotation != null ) {
        if ( ! convertAnnotation.disableConversion() ) {
          attributeConverterDefinition = mappings.locateAttributeConverter( convertAnnotation.converter() );
        }
      }
      else {
        attributeConverterDefinition = locateAutoApplyAttributeConverter( property );
      }
View Full Code Here

  }

  @SuppressWarnings("unchecked")
  private Convert locateConvertAnnotation(XProperty property) {
    // first look locally on the property for @Convert
    Convert localConvertAnnotation = property.getAnnotation( Convert.class );
    if ( localConvertAnnotation != null ) {
      return localConvertAnnotation;
    }

    if ( persistentClassName == null ) {
View Full Code Here

      // we have hit the root of the entity hierarchy
      return null;
    }

    {
      Convert convertAnnotation = owner.getAnnotation( Convert.class );
      if ( convertAnnotation != null && isMatch( convertAnnotation, property ) ) {
        return convertAnnotation;
      }
    }
View Full Code Here

    if ( ! canContainConvert ) {
      return;
    }

    {
      final Convert convertAnnotation = xClass.getAnnotation( Convert.class );
      if ( convertAnnotation != null ) {
        final AttributeConversionInfo info = new AttributeConversionInfo( convertAnnotation, xClass );
        if ( StringHelper.isEmpty( info.getAttributeName() ) ) {
          throw new IllegalStateException( "@Convert placed on @Entity/@MappedSuperclass must define attributeName" );
        }
View Full Code Here

      return;
    }

    {
      // @Convert annotation on the Embeddable attribute
      final Convert convertAnnotation = property.getAnnotation( Convert.class );
      if ( convertAnnotation != null ) {
        final AttributeConversionInfo info = new AttributeConversionInfo( convertAnnotation, property );
        if ( StringHelper.isEmpty( info.getAttributeName() ) ) {
          attributeConversionInfoMap.put( propertyName, info );
        }
View Full Code Here

TOP

Related Classes of javax.persistence.Convert

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.