Package org.hibernate.annotationfactory

Examples of org.hibernate.annotationfactory.AnnotationDescriptor


  private void getMapKey(List<Annotation> annotationList, Element element, XMLContext.Default defaults) {
    Element subelement = element != null ? element.element( "map-key" ) : null;
    if ( subelement != null ) {
      String mapKeyString = subelement.attributeValue( "name" );
      AnnotationDescriptor ad = new AnnotationDescriptor( MapKey.class );
      if ( StringHelper.isNotEmpty( mapKeyString ) ) ad.setValue( "name", mapKeyString );
      annotationList.add( AnnotationFactory.create( ad ) );
    }
  }
View Full Code Here


  }

  private void buildJoinColumns(List<Annotation> annotationList, Element element, XMLContext.Default defaults) {
    JoinColumn[] joinColumns = getJoinColumns( element, false );
    if ( joinColumns.length > 0 ) {
      AnnotationDescriptor ad = new AnnotationDescriptor( JoinColumns.class );
      ad.setValue( "value", joinColumns );
      annotationList.add( AnnotationFactory.create( ad ) );
    }
  }
View Full Code Here

  }

  private void getEmbedded(List<Annotation> annotationList, XMLContext.Default defaults) {
    for ( Element element : elementsForProperty ) {
      if ( "embedded".equals( element.getName() ) ) {
        AnnotationDescriptor ad = new AnnotationDescriptor( Embedded.class );
        annotationList.add( AnnotationFactory.create( ad ) );
      }
    }
    if ( elementsForProperty.size() == 0 && defaults.canUseJavaAnnotations() ) {
      Annotation annotation = super.getAnnotation( Embedded.class );
View Full Code Here

  }

  private Transient getTransient(XMLContext.Default defaults) {
    for ( Element element : elementsForProperty ) {
      if ( "transient".equals( element.getName() ) ) {
        AnnotationDescriptor ad = new AnnotationDescriptor( Transient.class );
        return AnnotationFactory.create( ad );
      }
    }
    if ( elementsForProperty.size() == 0 && defaults.canUseJavaAnnotations() ) {
      return super.getAnnotation( Transient.class );
View Full Code Here

    for ( Element element : elementsForProperty ) {
      if ( "version".equals( element.getName() ) ) {
        Annotation annotation = buildColumns( element );
        if ( annotation != null ) annotationList.add( annotation );
        getTemporal( annotationList, element );
        AnnotationDescriptor basic = new AnnotationDescriptor( Version.class );
        annotationList.add( AnnotationFactory.create( basic ) );
      }
    }
    if ( elementsForProperty.size() == 0 && defaults.canUseJavaAnnotations() ) {
      //we have nothing, so Java annotations might occurs
View Full Code Here

        Annotation annotation = buildColumns( element );
        if ( annotation != null ) annotationList.add( annotation );
        getTemporal( annotationList, element );
        getLob( annotationList, element );
        getEnumerated( annotationList, element );
        AnnotationDescriptor basic = new AnnotationDescriptor( Basic.class );
        getFetchType( basic, element );
        copyBooleanAttribute( basic, element, "optional" );
        annotationList.add( AnnotationFactory.create( basic ) );
      }
    }
View Full Code Here

  }

  private void getEnumerated(List<Annotation> annotationList, Element element) {
    Element subElement = element != null ? element.element( "enumerated" ) : null;
    if ( subElement != null ) {
      AnnotationDescriptor ad = new AnnotationDescriptor( Enumerated.class );
      String enumerated = subElement.getTextTrim();
      if ( "ORDINAL".equalsIgnoreCase( enumerated ) ) {
        ad.setValue( "value", EnumType.ORDINAL );
      }
      else if ( "STRING".equalsIgnoreCase( enumerated ) ) {
        ad.setValue( "value", EnumType.STRING );
      }
      else if ( StringHelper.isNotEmpty( enumerated ) ) {
        throw new AnnotationException( "Unknown EnumType: " + enumerated + ". " + SCHEMA_VALIDATION );
      }
      annotationList.add( AnnotationFactory.create( ad ) );
View Full Code Here

  }

  private void getLob(List<Annotation> annotationList, Element element) {
    Element subElement = element != null ? element.element( "lob" ) : null;
    if ( subElement != null ) {
      annotationList.add( AnnotationFactory.create( new AnnotationDescriptor( Lob.class ) ) );
    }
  }
View Full Code Here

        if ( isProcessingId( defaults ) ) {
          Annotation annotation = getAttributeOverrides( element, defaults );
          if ( annotation != null ) annotationList.add( annotation );
          annotation = getAssociationOverrides( element, defaults );
          if ( annotation != null ) annotationList.add( annotation );
          AnnotationDescriptor ad = new AnnotationDescriptor( EmbeddedId.class );
          annotationList.add( AnnotationFactory.create( ad ) );
        }
//        else {
//          if ( defaults.canUseJavaAnnotations() ) {
//            if ( ! properOverridingOnMetadataNonComplete ) {
View Full Code Here

          //FIXME: fix the priority of xml over java for generator names
          annotation = getTableGenerator( element, defaults );
          if ( annotation != null ) annotationList.add( annotation );
          annotation = getSequenceGenerator( element, defaults );
          if ( annotation != null ) annotationList.add( annotation );
          AnnotationDescriptor id = new AnnotationDescriptor( Id.class );
          annotationList.add( AnnotationFactory.create( id ) );
        }
//        else {
//          if ( defaults.canUseJavaAnnotations() ) {
//            if ( ! properOverridingOnMetadataNonComplete ) {
View Full Code Here

TOP

Related Classes of org.hibernate.annotationfactory.AnnotationDescriptor

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.