don't generate "auxiliary" members for Jakarta Data static metamodel
since it doesn't seem like these are very usueful with the repository programming model
This commit is contained in:
parent
c517833758
commit
cf626df3db
|
@ -187,18 +187,20 @@ public abstract class AnnotationMeta implements Metamodel {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addAuxiliaryMembersForMirror(AnnotationMirror mirror, String prefix) {
|
private void addAuxiliaryMembersForMirror(AnnotationMirror mirror, String prefix) {
|
||||||
mirror.getElementValues().forEach((key, value) -> {
|
if ( !isJakartaDataStyle() ) {
|
||||||
if ( key.getSimpleName().contentEquals("name") ) {
|
mirror.getElementValues().forEach((key, value) -> {
|
||||||
final String name = value.getValue().toString();
|
if ( key.getSimpleName().contentEquals("name") ) {
|
||||||
if ( !name.isEmpty() ) {
|
final String name = value.getValue().toString();
|
||||||
putMember( prefix + name, auxiliaryMember( mirror, prefix, name ) );
|
if ( !name.isEmpty() ) {
|
||||||
|
putMember( prefix + name, auxiliaryMember( mirror, prefix, name ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private NameMetaAttribute auxiliaryMember(AnnotationMirror mirror, String prefix, String name) {
|
private NameMetaAttribute auxiliaryMember(AnnotationMirror mirror, String prefix, String name) {
|
||||||
if ( !isJakartaDataStyle() && "QUERY_".equals(prefix) ) {
|
if ( "QUERY_".equals(prefix) ) {
|
||||||
final AnnotationValue resultClass = getAnnotationValue( mirror, "resultClass" );
|
final AnnotationValue resultClass = getAnnotationValue( mirror, "resultClass" );
|
||||||
// if there is no explicit result class, we will infer it later by
|
// if there is no explicit result class, we will infer it later by
|
||||||
// type checking the query (this is allowed but not required by JPA)
|
// type checking the query (this is allowed but not required by JPA)
|
||||||
|
@ -207,7 +209,7 @@ public abstract class AnnotationMeta implements Metamodel {
|
||||||
resultClass == null ? JAVA_OBJECT : resultClass.getValue().toString(),
|
resultClass == null ? JAVA_OBJECT : resultClass.getValue().toString(),
|
||||||
"jakarta.persistence.TypedQueryReference", null );
|
"jakarta.persistence.TypedQueryReference", null );
|
||||||
}
|
}
|
||||||
else if ( !isJakartaDataStyle() && "GRAPH_".equals(prefix) ) {
|
else if ( "GRAPH_".equals(prefix) ) {
|
||||||
return new TypedMetaAttribute( this, name, prefix, getQualifiedName(),
|
return new TypedMetaAttribute( this, name, prefix, getQualifiedName(),
|
||||||
"jakarta.persistence.EntityGraph", null );
|
"jakarta.persistence.EntityGraph", null );
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,8 +40,11 @@ class NameMetaAttribute implements MetaAttribute {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getAttributeNameDeclarationString() {
|
public String getAttributeNameDeclarationString() {
|
||||||
return new StringBuilder()
|
final StringBuilder declaration = new StringBuilder();
|
||||||
.append("public static final ")
|
if ( !annotationMetaEntity.isJakartaDataStyle() ) {
|
||||||
|
declaration.append( "public static final " );
|
||||||
|
}
|
||||||
|
return declaration
|
||||||
.append(annotationMetaEntity.importType(String.class.getName()))
|
.append(annotationMetaEntity.importType(String.class.getName()))
|
||||||
.append(' ')
|
.append(' ')
|
||||||
.append(prefix)
|
.append(prefix)
|
||||||
|
|
Loading…
Reference in New Issue