Skip to content
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 @@ -80,6 +80,8 @@ private static StringBuffer generateBody(Metamodel entity, Context context) {
final StringWriter sw = new StringWriter();
try ( PrintWriter pw = new PrintWriter(sw) ) {

pw.println( entity.javadoc() );

if ( context.addDependentAnnotation() && entity.isInjectable() ) {
pw.println( writeScopeAnnotation( entity ) );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,18 +187,20 @@ private void addAuxiliaryMembersForAnnotation(String annotationName, String pref
}

private void addAuxiliaryMembersForMirror(AnnotationMirror mirror, String prefix) {
mirror.getElementValues().forEach((key, value) -> {
if ( key.getSimpleName().contentEquals("name") ) {
final String name = value.getValue().toString();
if ( !name.isEmpty() ) {
putMember( prefix + name, auxiliaryMember( mirror, prefix, name ) );
if ( !isJakartaDataStyle() ) {
mirror.getElementValues().forEach((key, value) -> {
if ( key.getSimpleName().contentEquals("name") ) {
final String name = value.getValue().toString();
if ( !name.isEmpty() ) {
putMember( prefix + name, auxiliaryMember( mirror, prefix, 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" );
// 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)
Expand All @@ -207,7 +209,7 @@ private NameMetaAttribute auxiliaryMember(AnnotationMirror mirror, String prefix
resultClass == null ? JAVA_OBJECT : resultClass.getValue().toString(),
"jakarta.persistence.TypedQueryReference", null );
}
else if ( !isJakartaDataStyle() && "GRAPH_".equals(prefix) ) {
else if ( "GRAPH_".equals(prefix) ) {
return new TypedMetaAttribute( this, name, prefix, getQualifiedName(),
"jakarta.persistence.EntityGraph", null );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3107,4 +3107,20 @@ public List<AnnotationMirror> inheritedAnnotations() {
return emptyList();
}
}

@Override
public String javadoc() {
if ( jakartaDataRepository ) {
return "/**\n * Implements Jakarta Data repository {@link " + qualifiedName + "}\n **/";
}
else if ( repository ) {
return "/**\n * Implements repository {@link " + qualifiedName + "}\n **/";
}
else if ( jakartaDataStaticModel ) {
return "/**\n * Jakarta Data static metamodel for {@link " + qualifiedName + "}\n **/";
}
else {
return "/**\n * Static metamodel for {@link " + qualifiedName + "}\n **/";
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -170,4 +170,9 @@ public boolean isJakartaDataStyle() {
public List<AnnotationMirror> inheritedAnnotations() {
return emptyList();
}

@Override
public String javadoc() {
return "/**\n * Static metamodel package {@link " + element.getQualifiedName() + "}\n **/";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@ public String getAttributeDeclarationString() {

@Override
public String getAttributeNameDeclarationString() {
return new StringBuilder()
.append("public static final ")
final StringBuilder declaration = new StringBuilder();
if ( !annotationMetaEntity.isJakartaDataStyle() ) {
declaration.append( "public static final " );
}
return declaration
.append(annotationMetaEntity.importType(String.class.getName()))
.append(' ')
.append(prefix)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,6 @@ public interface Metamodel extends ImportContext {
boolean isJakartaDataStyle();

List<AnnotationMirror> inheritedAnnotations();

String javadoc();
}
Original file line number Diff line number Diff line change
Expand Up @@ -653,4 +653,9 @@ public boolean isJakartaDataStyle() {
public List<AnnotationMirror> inheritedAnnotations() {
return emptyList();
}

@Override
public String javadoc() {
return "/**\n * Static metamodel for {@link " + clazzName + "}\n **/";
}
}
Loading