Package org.hibernate.annotations.common.annotationfactory

Examples of org.hibernate.annotations.common.annotationfactory.AnnotationDescriptor


  }

  private void getOrderBy(List<Annotation> annotationList, Element element) {
    Element subelement = element != null ? element.element( "order-by" ) : null;
    if ( subelement != null ) {
      AnnotationDescriptor ad = new AnnotationDescriptor( OrderBy.class );
      copyStringElement( subelement, ad, "value" );
      annotationList.add( AnnotationFactory.create( ad ) );
    }
  }
View Full Code Here


  }

  private void getMapKey(List<Annotation> annotationList, Element element) {
    Element subelement = element != null ? element.element( "map-key" ) : null;
    if ( subelement != null ) {
      AnnotationDescriptor ad = new AnnotationDescriptor( MapKey.class );
      copyStringAttribute( ad, subelement, "name", false );
      annotationList.add( AnnotationFactory.create( ad ) );
    }
  }
View Full Code Here

  }

  private void getMapKeyColumn(List<Annotation> annotationList, Element element) {
    Element subelement = element != null ? element.element( "map-key-column" ) : null;
    if ( subelement != null ) {
      AnnotationDescriptor ad = new AnnotationDescriptor( MapKeyColumn.class );
      copyStringAttribute( ad, subelement, "name", false );
      copyBooleanAttribute( ad, subelement, "unique" );
      copyBooleanAttribute( ad, subelement, "nullable" );
      copyBooleanAttribute( ad, subelement, "insertable" );
      copyBooleanAttribute( ad, subelement, "updatable" );
View Full Code Here

  private void getMapKeyClass(List<Annotation> annotationList, Element element, XMLContext.Default defaults) {
    String nodeName = "map-key-class";
    Element subelement = element != null ? element.element( nodeName ) : null;
    if ( subelement != null ) {
      String mapKeyClassName = subelement.attributeValue( "class" );
      AnnotationDescriptor ad = new AnnotationDescriptor( MapKeyClass.class );
      if ( StringHelper.isNotEmpty( mapKeyClassName ) ) {
        Class clazz;
        try {
          clazz = ReflectHelper.classForName(
              XMLContext.buildSafeClassName( mapKeyClassName, defaults ),
              this.getClass()
          );
        }
        catch ( ClassNotFoundException e ) {
          throw new AnnotationException(
              "Unable to find " + element.getPath() + " " + nodeName + ": " + mapKeyClassName, e
          );
        }
        ad.setValue( "value", clazz );
      }
      annotationList.add( AnnotationFactory.create( ad ) );
    }
  }
View Full Code Here

  }

  private void getCollectionTable(List<Annotation> annotationList, Element element, XMLContext.Default defaults) {
    Element subelement = element != null ? element.element( "collection-table" ) : null;
    if ( subelement != null ) {
      AnnotationDescriptor annotation = new AnnotationDescriptor( CollectionTable.class );
      copyStringAttribute( annotation, subelement, "name", false );
      copyStringAttribute( annotation, subelement, "catalog", false );
      if ( StringHelper.isNotEmpty( defaults.getCatalog() )
          && StringHelper.isEmpty( (String) annotation.valueOf( "catalog" ) ) ) {
        annotation.setValue( "catalog", defaults.getCatalog() );
      }
      copyStringAttribute( annotation, subelement, "schema", false );
      if ( StringHelper.isNotEmpty( defaults.getSchema() )
          && StringHelper.isEmpty( (String) annotation.valueOf( "schema" ) ) ) {
        annotation.setValue( "schema", defaults.getSchema() );
      }
      JoinColumn[] joinColumns = getJoinColumns( subelement, false );
      if ( joinColumns.length > 0 ) {
        annotation.setValue( "joinColumns", joinColumns );
      }
      buildUniqueConstraints( annotation, subelement );
      annotationList.add( AnnotationFactory.create( annotation ) );
    }
  }
View Full Code Here

  }

  private void buildJoinColumns(List<Annotation> annotationList, Element element) {
    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 ) );
        Annotation annotation = getAttributeOverrides( element, defaults, false );
        addIfNotNull( annotationList, annotation );
        annotation = getAssociationOverrides( element, defaults, false );
        addIfNotNull( annotationList, annotation );
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 getJavaAnnotation( Transient.class );
View Full Code Here

    for ( Element element : elementsForProperty ) {
      if ( "version".equals( element.getName() ) ) {
        Annotation annotation = buildColumns( element );
        addIfNotNull( annotationList, annotation );
        getTemporal( annotationList, element );
        AnnotationDescriptor basic = new AnnotationDescriptor( Version.class );
        annotationList.add( AnnotationFactory.create( basic ) );
        getAccessType( annotationList, element );
      }
    }
    if ( elementsForProperty.size() == 0 && defaults.canUseJavaAnnotations() ) {
View Full Code Here

        addIfNotNull( annotationList, annotation );
        getAccessType( annotationList, element );
        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

TOP

Related Classes of org.hibernate.annotations.common.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.