string names for JD static metamodel were not generated

This commit is contained in:
Gavin King 2024-03-15 01:19:29 +01:00
parent 0d132f749d
commit fbebc65f0a
1 changed files with 13 additions and 2 deletions

View File

@ -11,6 +11,7 @@ import org.hibernate.processor.model.Metamodel;
import javax.lang.model.element.Element; import javax.lang.model.element.Element;
import static org.hibernate.processor.util.StringUtil.getUpperUnderscoreCaseFromLowerCamelCase;
import static org.hibernate.processor.util.TypeUtils.propertyName; import static org.hibernate.processor.util.TypeUtils.propertyName;
/** /**
@ -37,7 +38,7 @@ public class DataAnnotationMetaAttribute implements MetaAttribute {
@Override @Override
public boolean hasStringAttribute() { public boolean hasStringAttribute() {
return false; return true;
} }
private boolean isTextual() { private boolean isTextual() {
@ -73,7 +74,17 @@ public class DataAnnotationMetaAttribute implements MetaAttribute {
@Override @Override
public String getAttributeNameDeclarationString(){ public String getAttributeNameDeclarationString(){
throw new UnsupportedOperationException("operation not supported"); return new StringBuilder()
.append("public static final ")
.append(parent.importType(String.class.getName()))
.append(" ")
.append(getUpperUnderscoreCaseFromLowerCamelCase(getPropertyName()))
.append(" = ")
.append("\"")
.append(getPropertyName())
.append("\"")
.append(";")
.toString();
} }
@Override @Override