Revision: 10491
Author: ncha...@google.com
Date: Wed Aug 3 12:02:05 2011
Log: Include enclosing class in generated class name
Review at http://gwt-code-reviews.appspot.com/1499804
Review by: rchan...@google.com
http://code.google.com/p/google-web-toolkit/source/detail?r=10491
Modified:
/trunk/user/src/com/google/gwt/validation/rebind/AbstractCreator.java
/trunk/user/src/com/google/gwt/validation/rebind/ValidatorCreator.java
=======================================
--- /trunk/user/src/com/google/gwt/validation/rebind/AbstractCreator.java
Fri May 6 07:35:25 2011
+++ /trunk/user/src/com/google/gwt/validation/rebind/AbstractCreator.java
Wed Aug 3 12:02:05 2011
@@ -1,12 +1,12 @@
/*
* Copyright 2010 Google Inc.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License"); you may
not
* use this file except in compliance with the License. You may obtain a
copy of
* the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
@@ -59,7 +59,8 @@
return getQualifiedName();
}
- protected void addImports(ClassSourceFileComposerFactory
composerFactory, Class<?>... imports) {
+ protected void addImports(ClassSourceFileComposerFactory composerFactory,
+ Class<?>... imports) {
for (Class<?> imp : imports) {
composerFactory.addImport(imp.getCanonicalName());
}
@@ -82,37 +83,39 @@
String packageName = serviceIntfPkg == null ? "" :
serviceIntfPkg.getName();
return packageName;
}
+
+ protected String getSimpleName() {
+ final int length = getPackage().length();
+ final String rawName =
validatorType.getQualifiedSourceName().substring(
+ length == 0 ? 0 : length + 1);
+ return rawName.replace('.', '_') + "Impl";
+ }
protected abstract void writeClassBody(SourceWriter sourceWriter)
throws UnableToCompleteException;
protected void writeValidatorInstance(SourceWriter sw, BeanHelper bean) {
- BeanHelper.writeInterface(context, logger, bean);
- // private final MyBeanValidator myBeanValidator =
- sw.print("private final " + bean.getFullyQualifiedValidatorName()
+ " ");
- sw.print(bean.getValidatorInstanceName());
- sw.println(" = ");
- sw.indent();
- sw.indent();
-
- // MyBeanValidator.INSTANCE;
- sw.print(bean.getFullyQualifiedValidatorName());
- sw.println(".INSTANCE;");
- sw.outdent();
- sw.outdent();
- }
+ BeanHelper.writeInterface(context, logger, bean);
+ // private final MyBeanValidator myBeanValidator =
+ sw.print("private final " + bean.getFullyQualifiedValidatorName() + " ");
+ sw.print(bean.getValidatorInstanceName());
+ sw.println(" = ");
+ sw.indent();
+ sw.indent();
+
+ // MyBeanValidator.INSTANCE;
+ sw.print(bean.getFullyQualifiedValidatorName());
+ sw.println(".INSTANCE;");
+ sw.outdent();
+ sw.outdent();
+}
private String getQualifiedName() {
String packageName = getPackage();
return (packageName == "" ? "" : packageName + ".") + getSimpleName();
}
- private String getSimpleName() {
- return validatorType.getSimpleSourceName() + "Impl";
- }
-
- private SourceWriter getSourceWriter(TreeLogger logger,
- GeneratorContext ctx) {
+ private SourceWriter getSourceWriter(TreeLogger logger, GeneratorContext
ctx) {
String packageName = getPackage();
String simpleName = getSimpleName();
PrintWriter printWriter = ctx.tryCreate(logger, packageName,
simpleName);
=======================================
--- /trunk/user/src/com/google/gwt/validation/rebind/ValidatorCreator.java
Mon Jun 13 07:06:54 2011
+++ /trunk/user/src/com/google/gwt/validation/rebind/ValidatorCreator.java
Wed Aug 3 12:02:05 2011
@@ -93,10 +93,6 @@
sourceWriter.println();
writeGwtValidate(sourceWriter);
}
-
- private String getSimpleName() {
- return validatorType.getSimpleSourceName() + "Impl";
- }
private void writeConstructor(SourceWriter sw) {
// public MyValidator() {
--
http://groups.google.com/group/Google-Web-Toolkit-Contributors