Author: hardy.ferentschik
Date: 2010-10-07 08:22:12 -0400 (Thu, 07 Oct 2010)
New Revision: 20786
Modified:
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/annotation/AnnotationEmbeddable.java
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/annotation/AnnotationMetaAttribute.java
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/annotation/AnnotationMetaEntity.java
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/annotation/AnnotationMetaMap.java
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/model/MetaAttribute.java
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/util/FileTimeStampChecker.java
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/xml/XmlMetaAttribute.java
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/xml/XmlMetaCollection.java
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/xml/XmlMetaMap.java
Log:
METAGEN-28 Unrelated coding style fixes
Modified:
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/annotation/AnnotationEmbeddable.java
===================================================================
---
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/annotation/AnnotationEmbeddable.java 2010-10-07
12:21:20 UTC (rev 20785)
+++
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/annotation/AnnotationEmbeddable.java 2010-10-07
12:22:12 UTC (rev 20786)
@@ -46,7 +46,7 @@
public List<MetaAttribute> getMembers() {
if ( !initialized ) {
- context.logMessage( Diagnostic.Kind.OTHER, "Entity " + getQualifiedName() +
" was lazily initialised." );
+ getContext().logMessage( Diagnostic.Kind.OTHER, "Entity " +
getQualifiedName() + " was lazily initialised." );
init();
initialized = true;
}
@@ -57,10 +57,10 @@
public String toString() {
final StringBuilder sb = new StringBuilder();
sb.append( "AnnotationEmbeddable" );
- sb.append( "{element=" ).append( element );
+ sb.append( "{element=" ).append( getElement() );
sb.append( ", members=" );
if ( initialized ) {
- sb.append( members );
+ sb.append( getMembers() );
}
else {
sb.append( "[un-initalized]" );
Modified:
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/annotation/AnnotationMetaAttribute.java
===================================================================
---
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/annotation/AnnotationMetaAttribute.java 2010-10-07
12:21:20 UTC (rev 20785)
+++
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/annotation/AnnotationMetaAttribute.java 2010-10-07
12:22:12 UTC (rev 20786)
@@ -79,7 +79,7 @@
}
}
- public MetaEntity getParent() {
+ public MetaEntity getHostingEntity() {
return parent;
}
Modified:
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/annotation/AnnotationMetaEntity.java
===================================================================
---
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/annotation/AnnotationMetaEntity.java 2010-10-07
12:21:20 UTC (rev 20785)
+++
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/annotation/AnnotationMetaEntity.java 2010-10-07
12:22:12 UTC (rev 20786)
@@ -50,10 +50,10 @@
*/
public class AnnotationMetaEntity implements MetaEntity {
- protected final ImportContext importContext;
- protected final TypeElement element;
- protected final Map<String, MetaAttribute> members;
- protected Context context;
+ private final ImportContext importContext;
+ private final TypeElement element;
+ private final Map<String, MetaAttribute> members;
+ private Context context;
private AccessTypeInformation entityAccessTypeInfo;
@@ -75,19 +75,19 @@
return entityAccessTypeInfo;
}
- public Context getContext() {
+ public final Context getContext() {
return context;
}
- public String getSimpleName() {
+ public final String getSimpleName() {
return element.getSimpleName().toString();
}
- public String getQualifiedName() {
+ public final String getQualifiedName() {
return element.getQualifiedName().toString();
}
- public String getPackageName() {
+ public final String getPackageName() {
PackageElement packageOf = context.getElementUtils().getPackageOf( element );
return context.getElementUtils().getName( packageOf.getQualifiedName() ).toString();
}
@@ -117,6 +117,10 @@
return sb.toString();
}
+ protected TypeElement getElement() {
+ return element;
+ }
+
private void addPersistentMembers(List<? extends Element> membersOfClass,
AccessType membersKind) {
for ( Element memberOfClass : membersOfClass ) {
AccessType forcedAccessType = TypeUtils.determineAnnotationSpecifiedAccessType(
memberOfClass );
Modified:
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/annotation/AnnotationMetaMap.java
===================================================================
---
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/annotation/AnnotationMetaMap.java 2010-10-07
12:21:20 UTC (rev 20785)
+++
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/annotation/AnnotationMetaMap.java 2010-10-07
12:22:12 UTC (rev 20786)
@@ -37,7 +37,7 @@
}
public String getDeclarationString() {
- return "public static volatile " + getParent().importType( getMetaType() ) +
"<" + getParent().importType( getParent().getQualifiedName() ) + ",
" + getParent()
- .importType( keyType ) + ", " + getParent().importType(
getTypeDeclaration() ) + "> " + getPropertyName() + ";";
+ return "public static volatile " + getHostingEntity().importType(
getMetaType() ) + "<" + getHostingEntity().importType(
getHostingEntity().getQualifiedName() ) + ", " + getHostingEntity()
+ .importType( keyType ) + ", " + getHostingEntity().importType(
getTypeDeclaration() ) + "> " + getPropertyName() + ";";
}
}
Modified:
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/model/MetaAttribute.java
===================================================================
---
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/model/MetaAttribute.java 2010-10-07
12:21:20 UTC (rev 20785)
+++
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/model/MetaAttribute.java 2010-10-07
12:22:12 UTC (rev 20786)
@@ -31,5 +31,5 @@
String getTypeDeclaration();
- MetaEntity getParent();
+ MetaEntity getHostingEntity();
}
Modified:
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/util/FileTimeStampChecker.java
===================================================================
---
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/util/FileTimeStampChecker.java 2010-10-07
12:21:20 UTC (rev 20785)
+++
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/util/FileTimeStampChecker.java 2010-10-07
12:22:12 UTC (rev 20786)
@@ -28,9 +28,8 @@
*/
public class FileTimeStampChecker implements Serializable {
+ private Map<String, Long> lastModifiedCache;
- Map<String, Long> lastModifiedCache;
-
public FileTimeStampChecker() {
lastModifiedCache = new HashMap<String, Long>();
}
Modified:
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/xml/XmlMetaAttribute.java
===================================================================
---
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/xml/XmlMetaAttribute.java 2010-10-07
12:21:20 UTC (rev 20785)
+++
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/xml/XmlMetaAttribute.java 2010-10-07
12:22:12 UTC (rev 20786)
@@ -28,21 +28,21 @@
*/
public abstract class XmlMetaAttribute implements MetaAttribute {
- protected final XmlMetaEntity parentEntity;
+ private final XmlMetaEntity hostingEntity;
private final String propertyName;
private final String type;
XmlMetaAttribute(XmlMetaEntity parent, String propertyName, String type) {
- this.parentEntity = parent;
+ this.hostingEntity = parent;
this.propertyName = propertyName;
this.type = type;
}
@Override
public String getDeclarationString() {
- return "public static volatile " + parentEntity.importType( getMetaType() )
- + "<" + parentEntity.importType( parentEntity.getQualifiedName() )
- + ", " + parentEntity.importType( getTypeDeclaration() )
+ return "public static volatile " + hostingEntity.importType( getMetaType() )
+ + "<" + hostingEntity.importType( hostingEntity.getQualifiedName() )
+ + ", " + hostingEntity.importType( getTypeDeclaration() )
+ "> " + getPropertyName() + ";";
}
@@ -54,8 +54,8 @@
return type;
}
- public MetaEntity getParent() {
- return parentEntity;
+ public MetaEntity getHostingEntity() {
+ return hostingEntity;
}
@Override
Modified:
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/xml/XmlMetaCollection.java
===================================================================
---
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/xml/XmlMetaCollection.java 2010-10-07
12:21:20 UTC (rev 20785)
+++
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/xml/XmlMetaCollection.java 2010-10-07
12:22:12 UTC (rev 20786)
@@ -26,7 +26,7 @@
*/
public class XmlMetaCollection extends XmlMetaAttribute implements MetaCollection {
- String collectionType;
+ private String collectionType;
public XmlMetaCollection(XmlMetaEntity parent, String propertyName, String type,
String collectionType) {
super(parent, propertyName, type);
Modified: jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/xml/XmlMetaMap.java
===================================================================
---
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/xml/XmlMetaMap.java 2010-10-07
12:21:20 UTC (rev 20785)
+++
jpamodelgen/trunk/src/main/java/org/hibernate/jpamodelgen/xml/XmlMetaMap.java 2010-10-07
12:22:12 UTC (rev 20786)
@@ -19,6 +19,8 @@
package org.hibernate.jpamodelgen.xml;
+import org.hibernate.jpamodelgen.model.MetaEntity;
+
/**
* @author Hardy Ferentschik
*/
@@ -32,11 +34,18 @@
}
public String getDeclarationString() {
- return "public static volatile "
- + parentEntity.importType( getMetaType() )
- + "<" + parentEntity.importType( parentEntity.getQualifiedName() )
- + ", " + parentEntity.importType( keyType ) + ", "
- + parentEntity.importType( getTypeDeclaration() )
- + "> " + getPropertyName() + ";";
+ 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();
}
}
\ No newline at end of file