METAGEN-28 Unrelated coding style fixes
This commit is contained in:
parent
31a5497650
commit
3e0ecf66c0
|
@ -46,7 +46,7 @@ public class AnnotationEmbeddable extends AnnotationMetaEntity {
|
||||||
|
|
||||||
public List<MetaAttribute> getMembers() {
|
public List<MetaAttribute> getMembers() {
|
||||||
if ( !initialized ) {
|
if ( !initialized ) {
|
||||||
context.logMessage( Diagnostic.Kind.OTHER, "Entity " + getQualifiedName() + " was lazily initialised." );
|
getContext().logMessage( Diagnostic.Kind.OTHER, "Entity " + getQualifiedName() + " was lazily initialised." );
|
||||||
init();
|
init();
|
||||||
initialized = true;
|
initialized = true;
|
||||||
}
|
}
|
||||||
|
@ -57,10 +57,10 @@ public class AnnotationEmbeddable extends AnnotationMetaEntity {
|
||||||
public String toString() {
|
public String toString() {
|
||||||
final StringBuilder sb = new StringBuilder();
|
final StringBuilder sb = new StringBuilder();
|
||||||
sb.append( "AnnotationEmbeddable" );
|
sb.append( "AnnotationEmbeddable" );
|
||||||
sb.append( "{element=" ).append( element );
|
sb.append( "{element=" ).append( getElement() );
|
||||||
sb.append( ", members=" );
|
sb.append( ", members=" );
|
||||||
if ( initialized ) {
|
if ( initialized ) {
|
||||||
sb.append( members );
|
sb.append( getMembers() );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
sb.append( "[un-initalized]" );
|
sb.append( "[un-initalized]" );
|
||||||
|
|
|
@ -79,7 +79,7 @@ public abstract class AnnotationMetaAttribute implements MetaAttribute {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public MetaEntity getParent() {
|
public MetaEntity getHostingEntity() {
|
||||||
return parent;
|
return parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,10 +50,10 @@ import org.hibernate.jpamodelgen.util.TypeUtils;
|
||||||
*/
|
*/
|
||||||
public class AnnotationMetaEntity implements MetaEntity {
|
public class AnnotationMetaEntity implements MetaEntity {
|
||||||
|
|
||||||
protected final ImportContext importContext;
|
private final ImportContext importContext;
|
||||||
protected final TypeElement element;
|
private final TypeElement element;
|
||||||
protected final Map<String, MetaAttribute> members;
|
private final Map<String, MetaAttribute> members;
|
||||||
protected Context context;
|
private Context context;
|
||||||
|
|
||||||
private AccessTypeInformation entityAccessTypeInfo;
|
private AccessTypeInformation entityAccessTypeInfo;
|
||||||
|
|
||||||
|
@ -75,19 +75,19 @@ public class AnnotationMetaEntity implements MetaEntity {
|
||||||
return entityAccessTypeInfo;
|
return entityAccessTypeInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Context getContext() {
|
public final Context getContext() {
|
||||||
return context;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getSimpleName() {
|
public final String getSimpleName() {
|
||||||
return element.getSimpleName().toString();
|
return element.getSimpleName().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getQualifiedName() {
|
public final String getQualifiedName() {
|
||||||
return element.getQualifiedName().toString();
|
return element.getQualifiedName().toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getPackageName() {
|
public final String getPackageName() {
|
||||||
PackageElement packageOf = context.getElementUtils().getPackageOf( element );
|
PackageElement packageOf = context.getElementUtils().getPackageOf( element );
|
||||||
return context.getElementUtils().getName( packageOf.getQualifiedName() ).toString();
|
return context.getElementUtils().getName( packageOf.getQualifiedName() ).toString();
|
||||||
}
|
}
|
||||||
|
@ -117,6 +117,10 @@ public class AnnotationMetaEntity implements MetaEntity {
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected TypeElement getElement() {
|
||||||
|
return element;
|
||||||
|
}
|
||||||
|
|
||||||
private void addPersistentMembers(List<? extends Element> membersOfClass, AccessType membersKind) {
|
private void addPersistentMembers(List<? extends Element> membersOfClass, AccessType membersKind) {
|
||||||
for ( Element memberOfClass : membersOfClass ) {
|
for ( Element memberOfClass : membersOfClass ) {
|
||||||
AccessType forcedAccessType = TypeUtils.determineAnnotationSpecifiedAccessType( memberOfClass );
|
AccessType forcedAccessType = TypeUtils.determineAnnotationSpecifiedAccessType( memberOfClass );
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class AnnotationMetaMap extends AnnotationMetaCollection {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDeclarationString() {
|
public String getDeclarationString() {
|
||||||
return "public static volatile " + getParent().importType( getMetaType() ) + "<" + getParent().importType( getParent().getQualifiedName() ) + ", " + getParent()
|
return "public static volatile " + getHostingEntity().importType( getMetaType() ) + "<" + getHostingEntity().importType( getHostingEntity().getQualifiedName() ) + ", " + getHostingEntity()
|
||||||
.importType( keyType ) + ", " + getParent().importType( getTypeDeclaration() ) + "> " + getPropertyName() + ";";
|
.importType( keyType ) + ", " + getHostingEntity().importType( getTypeDeclaration() ) + "> " + getPropertyName() + ";";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,5 +31,5 @@ public interface MetaAttribute {
|
||||||
|
|
||||||
String getTypeDeclaration();
|
String getTypeDeclaration();
|
||||||
|
|
||||||
MetaEntity getParent();
|
MetaEntity getHostingEntity();
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,8 +28,7 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public class FileTimeStampChecker implements Serializable {
|
public class FileTimeStampChecker implements Serializable {
|
||||||
|
|
||||||
|
private Map<String, Long> lastModifiedCache;
|
||||||
Map<String, Long> lastModifiedCache;
|
|
||||||
|
|
||||||
public FileTimeStampChecker() {
|
public FileTimeStampChecker() {
|
||||||
lastModifiedCache = new HashMap<String, Long>();
|
lastModifiedCache = new HashMap<String, Long>();
|
||||||
|
|
|
@ -28,21 +28,21 @@ import org.hibernate.jpamodelgen.model.MetaEntity;
|
||||||
*/
|
*/
|
||||||
public abstract class XmlMetaAttribute implements MetaAttribute {
|
public abstract class XmlMetaAttribute implements MetaAttribute {
|
||||||
|
|
||||||
protected final XmlMetaEntity parentEntity;
|
private final XmlMetaEntity hostingEntity;
|
||||||
private final String propertyName;
|
private final String propertyName;
|
||||||
private final String type;
|
private final String type;
|
||||||
|
|
||||||
XmlMetaAttribute(XmlMetaEntity parent, String propertyName, String type) {
|
XmlMetaAttribute(XmlMetaEntity parent, String propertyName, String type) {
|
||||||
this.parentEntity = parent;
|
this.hostingEntity = parent;
|
||||||
this.propertyName = propertyName;
|
this.propertyName = propertyName;
|
||||||
this.type = type;
|
this.type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getDeclarationString() {
|
public String getDeclarationString() {
|
||||||
return "public static volatile " + parentEntity.importType( getMetaType() )
|
return "public static volatile " + hostingEntity.importType( getMetaType() )
|
||||||
+ "<" + parentEntity.importType( parentEntity.getQualifiedName() )
|
+ "<" + hostingEntity.importType( hostingEntity.getQualifiedName() )
|
||||||
+ ", " + parentEntity.importType( getTypeDeclaration() )
|
+ ", " + hostingEntity.importType( getTypeDeclaration() )
|
||||||
+ "> " + getPropertyName() + ";";
|
+ "> " + getPropertyName() + ";";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,8 +54,8 @@ public abstract class XmlMetaAttribute implements MetaAttribute {
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MetaEntity getParent() {
|
public MetaEntity getHostingEntity() {
|
||||||
return parentEntity;
|
return hostingEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -26,7 +26,7 @@ import org.hibernate.jpamodelgen.model.MetaCollection;
|
||||||
*/
|
*/
|
||||||
public class XmlMetaCollection extends XmlMetaAttribute implements MetaCollection {
|
public class XmlMetaCollection extends XmlMetaAttribute implements MetaCollection {
|
||||||
|
|
||||||
String collectionType;
|
private String collectionType;
|
||||||
|
|
||||||
public XmlMetaCollection(XmlMetaEntity parent, String propertyName, String type, String collectionType) {
|
public XmlMetaCollection(XmlMetaEntity parent, String propertyName, String type, String collectionType) {
|
||||||
super(parent, propertyName, type);
|
super(parent, propertyName, type);
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
package org.hibernate.jpamodelgen.xml;
|
package org.hibernate.jpamodelgen.xml;
|
||||||
|
|
||||||
|
import org.hibernate.jpamodelgen.model.MetaEntity;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Hardy Ferentschik
|
* @author Hardy Ferentschik
|
||||||
*/
|
*/
|
||||||
|
@ -32,11 +34,18 @@ public class XmlMetaMap extends XmlMetaCollection {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDeclarationString() {
|
public String getDeclarationString() {
|
||||||
return "public static volatile "
|
final MetaEntity hostingEntity = getHostingEntity();
|
||||||
+ parentEntity.importType( getMetaType() )
|
return new StringBuilder().append( "public static volatile " )
|
||||||
+ "<" + parentEntity.importType( parentEntity.getQualifiedName() )
|
.append( hostingEntity.importType( getMetaType() ) )
|
||||||
+ ", " + parentEntity.importType( keyType ) + ", "
|
.append( "<" )
|
||||||
+ parentEntity.importType( getTypeDeclaration() )
|
.append( hostingEntity.importType( hostingEntity.getQualifiedName() ) )
|
||||||
+ "> " + getPropertyName() + ";";
|
.append( ", " )
|
||||||
|
.append( hostingEntity.importType( keyType ) )
|
||||||
|
.append( ", " )
|
||||||
|
.append( hostingEntity.importType( getTypeDeclaration() ) )
|
||||||
|
.append( "> " )
|
||||||
|
.append( getPropertyName() )
|
||||||
|
.append( ";" )
|
||||||
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue