-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
149 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
78 changes: 78 additions & 0 deletions
78
...c/main/java/org/hibernate/boot/models/annotations/internal/NativeGeneratorAnnotation.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/* | ||
* Hibernate, Relational Persistence for Idiomatic Java | ||
* | ||
* License: GNU Lesser General Public License (LGPL), version 2.1 or later. | ||
* See the lgpl.txt file in the root directory or http://www.gnu.org/licenses/lgpl-2.1.html. | ||
*/ | ||
package org.hibernate.boot.models.annotations.internal; | ||
|
||
import jakarta.persistence.SequenceGenerator; | ||
import jakarta.persistence.TableGenerator; | ||
import org.hibernate.annotations.NativeGenerator; | ||
import org.hibernate.boot.model.internal.GeneratorStrategies; | ||
import org.hibernate.models.spi.SourceModelBuildingContext; | ||
|
||
import java.lang.annotation.Annotation; | ||
import java.util.Map; | ||
|
||
@SuppressWarnings({ "ClassExplicitlyAnnotation", "unused" }) | ||
@jakarta.annotation.Generated("org.hibernate.orm.build.annotations.ClassGeneratorProcessor") | ||
public class NativeGeneratorAnnotation implements NativeGenerator { | ||
private SequenceGenerator sequenceForm; | ||
private TableGenerator tableForm; | ||
|
||
/** | ||
* Used in legacy hbm.xml handling. See {@linkplain GeneratorStrategies#generatorClass} | ||
*/ | ||
public NativeGeneratorAnnotation() { | ||
this.sequenceForm = new SequenceGeneratorJpaAnnotation( null ); | ||
this.tableForm = new TableGeneratorJpaAnnotation( null ); | ||
} | ||
|
||
/** | ||
* Used in creating dynamic annotation instances (e.g. from XML) | ||
*/ | ||
public NativeGeneratorAnnotation(SourceModelBuildingContext modelContext) { | ||
this.sequenceForm = new SequenceGeneratorJpaAnnotation( modelContext ); | ||
this.tableForm = new TableGeneratorJpaAnnotation( modelContext ); | ||
} | ||
|
||
/** | ||
* Used in creating annotation instances from JDK variant | ||
*/ | ||
public NativeGeneratorAnnotation(NativeGenerator annotation, SourceModelBuildingContext modelContext) { | ||
this.sequenceForm = annotation.sequenceForm(); | ||
this.tableForm = annotation.tableForm(); | ||
} | ||
|
||
/** | ||
* Used in creating annotation instances from Jandex variant | ||
*/ | ||
public NativeGeneratorAnnotation(Map<String, Object> attributeValues, SourceModelBuildingContext modelContext) { | ||
this.sequenceForm = (SequenceGenerator) attributeValues.get( "sequenceForm" ); | ||
this.tableForm = (TableGenerator) attributeValues.get( "tableForm" ); | ||
} | ||
|
||
@Override | ||
public SequenceGenerator sequenceForm() { | ||
return sequenceForm; | ||
} | ||
|
||
public void sequenceForm(SequenceGenerator sequenceForm) { | ||
this.sequenceForm = sequenceForm; | ||
} | ||
|
||
@Override | ||
public TableGenerator tableForm() { | ||
return tableForm; | ||
} | ||
|
||
public void tableForm(TableGenerator tableForm) { | ||
this.tableForm = tableForm; | ||
} | ||
|
||
@Override | ||
public Class<? extends Annotation> annotationType() { | ||
return NativeGenerator.class; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters