org.hibernate.jpamodelgen.xml.XmlMetaMap Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hibernate-jpamodelgen-jakarta Show documentation
Show all versions of hibernate-jpamodelgen-jakarta Show documentation
Annotation Processor to generate JPA 3 static metamodel classes
/*
* 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 .
*/
package org.hibernate.jpamodelgen.xml;
import org.hibernate.jpamodelgen.model.MetaEntity;
/**
* @author Hardy Ferentschik
*/
public class XmlMetaMap extends XmlMetaCollection {
private final String keyType;
public XmlMetaMap(XmlMetaEntity parent, String propertyName, String type, String collectionType, String keyType) {
super( parent, propertyName, type, collectionType );
this.keyType = keyType;
}
@Override
public String getAttributeDeclarationString() {
final MetaEntity hostingEntity = getHostingEntity();
return new StringBuilder().append( "public static volatile " )
.append( hostingEntity.importType( getMetaType() ) )
.append( "<" )
.append( hostingEntity.importType( hostingEntity.getQualifiedName() ) )
.append( ", " )
.append( hostingEntity.importType( keyType ) )
.append( ", " )
.append( hostingEntity.importType( getTypeDeclaration() ) )
.append( "> " )
.append( getPropertyName() )
.append( ";" )
.toString();
}
}