Package javax.persistence

Examples of javax.persistence.Convert


      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


        }
        catch (ClassNotFoundException e) {
          throw new AnnotationException( "Unable to find specified converter class id-class: " + converterClassName, e );
        }
      }
      final Convert convertAnnotation = AnnotationFactory.create( convertAnnotationDescriptor );
      final String qualifiedAttributeName = qualifyConverterAttributeName(
          attributeNamePrefix,
          convertAnnotation.attributeName()
      );
      convertAnnotationsMap.put( qualifiedAttributeName, convertAnnotation );
    }

  }
View Full Code Here

  }

  private void applyPhysicalConvertAnnotations(
      String attributeNamePrefix,
      Map<String, Convert> convertAnnotationsMap) {
    final Convert physicalAnnotation = getPhysicalAnnotation( Convert.class );
    if ( physicalAnnotation != null ) {
      // only add if no XML element named a converter for this attribute
      final String qualifiedAttributeName = qualifyConverterAttributeName( attributeNamePrefix, physicalAnnotation.attributeName() );
      if ( ! convertAnnotationsMap.containsKey( qualifiedAttributeName ) ) {
        convertAnnotationsMap.put( qualifiedAttributeName, physicalAnnotation );
      }
    }
    final Converts physicalGroupingAnnotation = getPhysicalAnnotation( Converts.class );
View Full Code Here

      // 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

    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

    // 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

    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.