Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing metadata for hibernate-core #496

Merged
merged 2 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,46 @@
"name":"org.hibernate.event.spi.EventType",
"allDeclaredFields":true
},
{
"condition":{"typeReachable":"org.hibernate.id.factory.internal.StandardIdentifierGeneratorFactory"},
"name":"org.hibernate.generator.internal.CurrentTimestampGeneration",
"queryAllDeclaredConstructors":true,
"methods":[
{"name":"<init>","parameterTypes":["org.hibernate.annotations.CreationTimestamp","java.lang.reflect.Member","org.hibernate.generator.GeneratorCreationContext"] },
{"name":"<init>","parameterTypes":["org.hibernate.annotations.CurrentTimestamp","java.lang.reflect.Member","org.hibernate.generator.GeneratorCreationContext"] },
{"name":"<init>","parameterTypes":["org.hibernate.annotations.UpdateTimestamp","java.lang.reflect.Member","org.hibernate.generator.GeneratorCreationContext"] }
]
},
{
"condition":{"typeReachable":"org.hibernate.id.factory.internal.StandardIdentifierGeneratorFactory"},
"name":"org.hibernate.generator.internal.GeneratedAlwaysGeneration",
"queryAllDeclaredConstructors":true,
"methods":[{"name":"<init>","parameterTypes":[] }]
},
{
"condition":{"typeReachable":"org.hibernate.id.factory.internal.StandardIdentifierGeneratorFactory"},
"name":"org.hibernate.generator.internal.GeneratedGeneration",
"queryAllDeclaredConstructors":true,
"methods":[
{"name":"<init>","parameterTypes":["org.hibernate.annotations.Generated"] },
{"name":"<init>","parameterTypes":["org.hibernate.annotations.GenerationTime"] }
]
},
{
"condition":{"typeReachable":"org.hibernate.id.factory.internal.StandardIdentifierGeneratorFactory"},
"name":"org.hibernate.generator.internal.SourceGeneration",
"queryAllDeclaredConstructors":true,
"methods":[
{"name":"<init>","parameterTypes":["org.hibernate.annotations.Source","java.lang.reflect.Member","org.hibernate.generator.GeneratorCreationContext"] },
{"name":"<init>","parameterTypes":["org.hibernate.annotations.SourceType","java.lang.Class","org.hibernate.generator.GeneratorCreationContext"] }
]
},
{
"condition":{"typeReachable":"org.hibernate.id.factory.internal.StandardIdentifierGeneratorFactory"},
"name":"org.hibernate.generator.internal.TenantIdGeneration",
"queryAllDeclaredConstructors":true,
"methods":[{"name":"<init>","parameterTypes":["org.hibernate.annotations.TenantId","java.lang.reflect.Member","org.hibernate.generator.GeneratorCreationContext"] }]
},
{
"condition":{"typeReachable":"org.hibernate.id.factory.internal.StandardIdentifierGeneratorFactory"},
"name":"org.hibernate.id.Assigned",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,46 @@
"name":"org.hibernate.event.spi.EventType",
"allDeclaredFields":true
},
{
"condition":{"typeReachable":"org.hibernate.id.factory.internal.StandardIdentifierGeneratorFactory"},
"name":"org.hibernate.generator.internal.CurrentTimestampGeneration",
"queryAllDeclaredConstructors":true,
"methods":[
{"name":"<init>","parameterTypes":["org.hibernate.annotations.CreationTimestamp","java.lang.reflect.Member","org.hibernate.generator.GeneratorCreationContext"] },
{"name":"<init>","parameterTypes":["org.hibernate.annotations.CurrentTimestamp","java.lang.reflect.Member","org.hibernate.generator.GeneratorCreationContext"] },
{"name":"<init>","parameterTypes":["org.hibernate.annotations.UpdateTimestamp","java.lang.reflect.Member","org.hibernate.generator.GeneratorCreationContext"] }
]
},
{
"condition":{"typeReachable":"org.hibernate.id.factory.internal.StandardIdentifierGeneratorFactory"},
"name":"org.hibernate.generator.internal.GeneratedAlwaysGeneration",
"queryAllDeclaredConstructors":true,
"methods":[{"name":"<init>","parameterTypes":[] }]
},
{
"condition":{"typeReachable":"org.hibernate.id.factory.internal.StandardIdentifierGeneratorFactory"},
"name":"org.hibernate.generator.internal.GeneratedGeneration",
"queryAllDeclaredConstructors":true,
"methods":[
{"name":"<init>","parameterTypes":["org.hibernate.annotations.Generated"] },
{"name":"<init>","parameterTypes":["org.hibernate.annotations.GenerationTime"] }
]
},
{
"condition":{"typeReachable":"org.hibernate.id.factory.internal.StandardIdentifierGeneratorFactory"},
"name":"org.hibernate.generator.internal.SourceGeneration",
"queryAllDeclaredConstructors":true,
"methods":[
{"name":"<init>","parameterTypes":["org.hibernate.annotations.Source","java.lang.reflect.Member","org.hibernate.generator.GeneratorCreationContext"] },
{"name":"<init>","parameterTypes":["org.hibernate.annotations.SourceType","java.lang.Class","org.hibernate.generator.GeneratorCreationContext"] }
]
},
{
"condition":{"typeReachable":"org.hibernate.id.factory.internal.StandardIdentifierGeneratorFactory"},
"name":"org.hibernate.generator.internal.TenantIdGeneration",
"queryAllDeclaredConstructors":true,
"methods":[{"name":"<init>","parameterTypes":["org.hibernate.annotations.TenantId","java.lang.reflect.Member","org.hibernate.generator.GeneratorCreationContext"] }]
},
{
"condition":{"typeReachable":"org.hibernate.id.factory.internal.StandardIdentifierGeneratorFactory"},
"name":"org.hibernate.id.Assigned",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,32 @@ public class IdentifierGeneratorTest {
org.hibernate.id.ForeignGenerator.class
};

private static final Class[] VALUE_GENERATION_TYPE_GENERATORS_FROM_ANNOTATIONS = new Class[]{
org.hibernate.generator.internal.CurrentTimestampGeneration.class,
org.hibernate.generator.internal.GeneratedAlwaysGeneration.class,
org.hibernate.generator.internal.GeneratedGeneration.class,
org.hibernate.generator.internal.SourceGeneration.class,
org.hibernate.generator.internal.TenantIdGeneration.class
};

@Test
public void testIdentifierGenerators() throws Exception {
for (Class clazz : identifierGenerators) {
Constructor constructor = clazz.getConstructor();
assertThat(constructor).isNotNull();
}
}

/**
* {@link org.hibernate.annotations.ValueGenerationType#generatedBy()} may hold types reflectively instantiated.
* This uses a list of those to make sure hints are present.
*/
@Test
public void testValueGenerationTypes() throws Exception {
for (Class clazz : VALUE_GENERATION_TYPE_GENERATORS_FROM_ANNOTATIONS) {
for (Constructor<?> ctor : clazz.getDeclaredConstructors()) {
assertThat(clazz.getConstructor(ctor.getParameterTypes())).isEqualTo(ctor);
}
}
}
}
Loading