You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by ke...@apache.org on 2007/05/29 18:53:22 UTC
svn commit: r542588 [1/2] - in /incubator/tuscany/java/sdo:
impl/src/main/java/org/apache/tuscany/sdo/impl/
tools/src/main/java/org/apache/tuscany/sdo/generate/templates/model/
tools/src/test/java/com/example/customer/
tools/src/test/java/com/example/c...
Author: kelvingoodson
Date: Tue May 29 09:53:20 2007
New Revision: 542588
URL: http://svn.apache.org/viewvc?view=rev&rev=542588
Log:
TUSCANY-1305 avoid early caching of structural features when generated classes are still initializing metadata
Added:
incubator/tuscany/java/sdo/tools/src/test/java/com/example/customer/
incubator/tuscany/java/sdo/tools/src/test/java/com/example/customer/Account.java
incubator/tuscany/java/sdo/tools/src/test/java/com/example/customer/Customer.java
incubator/tuscany/java/sdo/tools/src/test/java/com/example/customer/CustomerFactory.java
incubator/tuscany/java/sdo/tools/src/test/java/com/example/customer/impl/
incubator/tuscany/java/sdo/tools/src/test/java/com/example/customer/impl/AccountImpl.java
incubator/tuscany/java/sdo/tools/src/test/java/com/example/customer/impl/CustomerFactoryImpl.java
incubator/tuscany/java/sdo/tools/src/test/java/com/example/customer/impl/CustomerImpl.java
Modified:
incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/FactoryBase.java
incubator/tuscany/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/templates/model/SDOFactoryClass.java
incubator/tuscany/java/sdo/tools/src/test/java/org/apache/tuscany/sdo/test/ChangeSummaryGenTestCase.java
incubator/tuscany/java/sdo/tools/templates/models/SDOFactoryClass.javajet
Modified: incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/FactoryBase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/FactoryBase.java?view=diff&rev=542588&r1=542587&r2=542588
==============================================================================
--- incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/FactoryBase.java (original)
+++ incubator/tuscany/java/sdo/impl/src/main/java/org/apache/tuscany/sdo/impl/FactoryBase.java Tue May 29 09:53:20 2007
@@ -121,10 +121,20 @@
createEReference((EClass)containingType, internalPropertyNumber);
}
+ /**
+ * @deprecated - use getLocalProperty instead, since getProperty causes
+ * caching of structural features.
+ */
protected Property getProperty(Type type, int internalPropertyNumber)
{
return (Property)((EClass)type).getEAllStructuralFeatures().get(internalPropertyNumber);
}
+
+ protected Property getLocalProperty(Type type, int localPropertyIndex)
+ {
+ return (Property)((EClass)type).getEStructuralFeatures().get(localPropertyIndex);
+ }
+
protected void initializeType(Type type, Class instanceClass, String name)
{
Modified: incubator/tuscany/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/templates/model/SDOFactoryClass.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/templates/model/SDOFactoryClass.java?view=diff&rev=542588&r1=542587&r2=542588
==============================================================================
--- incubator/tuscany/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/templates/model/SDOFactoryClass.java (original)
+++ incubator/tuscany/java/sdo/tools/src/main/java/org/apache/tuscany/sdo/generate/templates/model/SDOFactoryClass.java Tue May 29 09:53:20 2007
@@ -185,180 +185,179 @@
protected final String TEXT_145 = "\", ";
protected final String TEXT_146 = ", ";
protected final String TEXT_147 = ");";
- protected final String TEXT_148 = NL + "\t\tproperty = getProperty(";
+ protected final String TEXT_148 = NL + "\t\tproperty = getLocalProperty(";
protected final String TEXT_149 = "Type, ";
- protected final String TEXT_150 = ".INTERNAL_";
- protected final String TEXT_151 = ");";
- protected final String TEXT_152 = NL + "\t\tinitializeProperty(property, ";
- protected final String TEXT_153 = ", \"";
- protected final String TEXT_154 = "\", ";
+ protected final String TEXT_150 = ");";
+ protected final String TEXT_151 = NL + "\t\tinitializeProperty(property, ";
+ protected final String TEXT_152 = ", \"";
+ protected final String TEXT_153 = "\", ";
+ protected final String TEXT_154 = ", ";
protected final String TEXT_155 = ", ";
protected final String TEXT_156 = ", ";
protected final String TEXT_157 = ", ";
protected final String TEXT_158 = ", ";
protected final String TEXT_159 = ", ";
protected final String TEXT_160 = ", ";
- protected final String TEXT_161 = ", ";
- protected final String TEXT_162 = " , ";
- protected final String TEXT_163 = ");";
- protected final String TEXT_164 = NL + "\t\tinitializeProperty(property, ";
- protected final String TEXT_165 = ", \"";
- protected final String TEXT_166 = "\", ";
+ protected final String TEXT_161 = " , ";
+ protected final String TEXT_162 = ");";
+ protected final String TEXT_163 = NL + "\t\tinitializeProperty(property, ";
+ protected final String TEXT_164 = ", \"";
+ protected final String TEXT_165 = "\", ";
+ protected final String TEXT_166 = ", ";
protected final String TEXT_167 = ", ";
protected final String TEXT_168 = ", ";
protected final String TEXT_169 = ", ";
protected final String TEXT_170 = ", ";
protected final String TEXT_171 = ", ";
- protected final String TEXT_172 = ", ";
- protected final String TEXT_173 = ");";
- protected final String TEXT_174 = NL + "\t\tsetInstanceProperty (property, \"";
- protected final String TEXT_175 = "\", ";
- protected final String TEXT_176 = ", ";
- protected final String TEXT_177 = ");";
- protected final String TEXT_178 = NL;
- protected final String TEXT_179 = NL + "\t\t// Initialize data types";
- protected final String TEXT_180 = NL + "\t\tinitializeType(";
- protected final String TEXT_181 = "Type, ";
- protected final String TEXT_182 = ".class, \"";
- protected final String TEXT_183 = "\", ";
- protected final String TEXT_184 = ", ";
- protected final String TEXT_185 = ");";
- protected final String TEXT_186 = NL + "\t\tsetInstanceProperty (";
- protected final String TEXT_187 = "Type, \"";
- protected final String TEXT_188 = "\", ";
- protected final String TEXT_189 = ", ";
- protected final String TEXT_190 = ");";
- protected final String TEXT_191 = NL;
- protected final String TEXT_192 = NL + "\t\tcreateXSDMetaData(";
- protected final String TEXT_193 = ");" + NL + "\t}" + NL + "\t " + NL + "\tprotected void createXSDMetaData(";
- protected final String TEXT_194 = ")" + NL + "\t{" + NL + "\t\tsuper.initXSD();" + NL + "\t\t" + NL + "\t\t";
- protected final String TEXT_195 = " property = null;" + NL + "\t\t";
- protected final String TEXT_196 = NL + "\t\taddXSDMapping" + NL + "\t\t (new String[]" + NL + "\t\t\t {";
- protected final String TEXT_197 = NL + "\t\t\t ";
- protected final String TEXT_198 = ", ";
- protected final String TEXT_199 = NL + "\t\t\t });" + NL;
- protected final String TEXT_200 = NL;
- protected final String TEXT_201 = NL + "\t\taddXSDMapping" + NL + "\t\t (";
- protected final String TEXT_202 = "Type," + NL + "\t\t\t new String[] " + NL + "\t\t\t {";
- protected final String TEXT_203 = NL + "\t\t\t ";
- protected final String TEXT_204 = ", ";
- protected final String TEXT_205 = NL + "\t\t\t });" + NL;
- protected final String TEXT_206 = NL + "\t\tproperty = createGlobalProperty" + NL + "\t\t (\"";
- protected final String TEXT_207 = "\"," + NL + "\t\t ";
- protected final String TEXT_208 = ".get";
- protected final String TEXT_209 = "()," + NL + "\t\t\t new String[]" + NL + "\t\t\t {";
- protected final String TEXT_210 = NL + "\t\t\t ";
- protected final String TEXT_211 = ", ";
- protected final String TEXT_212 = NL + "\t\t\t }," + NL + "\t\t\t IS_ATTRIBUTE);";
- protected final String TEXT_213 = NL + "\t\t\t });";
- protected final String TEXT_214 = NL + " ";
- protected final String TEXT_215 = NL + "\t\tsetInstanceProperty" + NL + "\t\t (property," + NL + "\t\t\t \"";
- protected final String TEXT_216 = "\"," + NL + "\t\t\t ";
- protected final String TEXT_217 = ", ";
- protected final String TEXT_218 = ");";
- protected final String TEXT_219 = NL + " ";
- protected final String TEXT_220 = " ";
- protected final String TEXT_221 = NL + "\t\taddXSDMapping" + NL + "\t\t\t(getProperty(";
- protected final String TEXT_222 = "Type, ";
- protected final String TEXT_223 = ".INTERNAL_";
- protected final String TEXT_224 = ")," + NL + "\t\t\t new String[]" + NL + "\t\t\t {";
- protected final String TEXT_225 = NL + "\t\t\t ";
- protected final String TEXT_226 = ", ";
- protected final String TEXT_227 = NL + "\t\t\t });" + NL;
- protected final String TEXT_228 = NL + " }" + NL + " ";
- protected final String TEXT_229 = NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
- protected final String TEXT_230 = " create";
- protected final String TEXT_231 = "FromString(String initialValue)" + NL + "\t{";
- protected final String TEXT_232 = NL + "\t\t";
- protected final String TEXT_233 = " result = ";
- protected final String TEXT_234 = ".get(initialValue);" + NL + "\t\tif (result == null) throw new IllegalArgumentException(\"The value '\" + initialValue + \"' is not a valid enumerator of '\" + type.getName() + \"'\");";
- protected final String TEXT_235 = NL + "\t\treturn result;";
- protected final String TEXT_236 = NL + "\t\treturn (";
- protected final String TEXT_237 = ")create";
- protected final String TEXT_238 = "FromString(initialValue);";
- protected final String TEXT_239 = NL + "\t\treturn (";
- protected final String TEXT_240 = ")";
- protected final String TEXT_241 = ".create";
- protected final String TEXT_242 = "FromString(initialValue);";
- protected final String TEXT_243 = NL + "\t\tif (initialValue == null) return null;" + NL + "\t\t";
- protected final String TEXT_244 = " result = new ";
- protected final String TEXT_245 = "();" + NL + "\t\tfor (";
- protected final String TEXT_246 = " stringTokenizer = new ";
- protected final String TEXT_247 = "(initialValue); stringTokenizer.hasMoreTokens(); )" + NL + "\t\t{" + NL + "\t\t\tString item = stringTokenizer.nextToken();";
- protected final String TEXT_248 = NL + "\t\t\tresult.add(create";
- protected final String TEXT_249 = "FromString(item));";
- protected final String TEXT_250 = NL + "\t\t\tresult.add(";
- protected final String TEXT_251 = ".create";
- protected final String TEXT_252 = "FromString(item));";
- protected final String TEXT_253 = NL + "\t\t}" + NL + "\t\treturn result;";
- protected final String TEXT_254 = NL + "\t\tif (initialValue == null) return null;" + NL + "\t\t";
- protected final String TEXT_255 = " result = null;" + NL + "\t\tRuntimeException exception = null;";
- protected final String TEXT_256 = NL + "\t\ttry" + NL + "\t\t{";
- protected final String TEXT_257 = NL + "\t\t\tresult = (";
- protected final String TEXT_258 = ")create";
- protected final String TEXT_259 = "FromString(initialValue);";
- protected final String TEXT_260 = NL + "\t\t\tresult = (";
- protected final String TEXT_261 = ")";
- protected final String TEXT_262 = ".create";
- protected final String TEXT_263 = "FromString(initialValue);";
- protected final String TEXT_264 = NL + "\t\t\tif (result != null/* && Diagnostician.INSTANCE.validate(type, result, null, null)*/)" + NL + "\t\t\t{" + NL + "\t\t\t\treturn result;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\tcatch (RuntimeException e)" + NL + "\t\t{" + NL + "\t\t\texception = e;" + NL + "\t\t}";
- protected final String TEXT_265 = NL + "\t\tif (result != null || exception == null) return result;" + NL + " " + NL + "\t\tthrow exception;";
- protected final String TEXT_266 = NL + "\t\t// TODO: implement this method" + NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new ";
- protected final String TEXT_267 = "();";
- protected final String TEXT_268 = NL + "\t\treturn (";
- protected final String TEXT_269 = ")super.createFromString(";
- protected final String TEXT_270 = ", initialValue);";
- protected final String TEXT_271 = NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic String convert";
- protected final String TEXT_272 = "ToString(Object instanceValue)" + NL + "\t{";
- protected final String TEXT_273 = NL + "\t\treturn instanceValue == null ? null : instanceValue.toString();";
- protected final String TEXT_274 = NL + "\t\treturn convert";
- protected final String TEXT_275 = "ToString(instanceValue);";
- protected final String TEXT_276 = NL + "\t\treturn ";
- protected final String TEXT_277 = ".convert";
- protected final String TEXT_278 = "ToString(instanceValue);";
- protected final String TEXT_279 = NL + "\t\tif (instanceValue == null) return null;" + NL + "\t\t";
- protected final String TEXT_280 = " list = (";
- protected final String TEXT_281 = ")instanceValue;" + NL + "\t\tif (list.isEmpty()) return \"\";" + NL + "\t\t";
- protected final String TEXT_282 = " result = new ";
- protected final String TEXT_283 = "();" + NL + "\t\tfor (";
- protected final String TEXT_284 = " i = list.iterator(); i.hasNext(); )" + NL + "\t\t{";
- protected final String TEXT_285 = NL + "\t\t\tresult.append(convert";
- protected final String TEXT_286 = "ToString(i.next()));";
- protected final String TEXT_287 = NL + "\t\t\tresult.append(";
- protected final String TEXT_288 = ".convert";
- protected final String TEXT_289 = "ToString(i.next()));";
- protected final String TEXT_290 = NL + "\t\t\tresult.append(' ');" + NL + "\t\t}" + NL + "\t\treturn result.substring(0, result.length() - 1);";
- protected final String TEXT_291 = NL + "\t\tif (instanceValue == null) return null;";
- protected final String TEXT_292 = NL + "\t\tif (";
- protected final String TEXT_293 = ".isInstance(instanceValue))" + NL + "\t\t{" + NL + "\t\t\ttry" + NL + "\t\t\t{";
- protected final String TEXT_294 = NL + "\t\t\t\tString value = convert";
- protected final String TEXT_295 = "ToString(instanceValue);";
- protected final String TEXT_296 = NL + "\t\t\t\tString value = ";
- protected final String TEXT_297 = ".convert";
- protected final String TEXT_298 = "ToString(instanceValue);";
- protected final String TEXT_299 = NL + "\t\t\t\tif (value != null) return value;" + NL + "\t\t\t}" + NL + "\t\t\tcatch (Exception e)" + NL + "\t\t\t{" + NL + "\t\t\t}" + NL + "\t\t}";
- protected final String TEXT_300 = NL + "\t\tthrow new IllegalArgumentException(\"Invalid value: '\"+instanceValue+\"' for datatype :";
- protected final String TEXT_301 = "\");";
- protected final String TEXT_302 = NL + "\t\t// TODO: implement this method" + NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new ";
- protected final String TEXT_303 = "();";
- protected final String TEXT_304 = NL + "\t\treturn super.convertToString(";
- protected final String TEXT_305 = ", instanceValue);";
- protected final String TEXT_306 = NL + "\t}" + NL;
- protected final String TEXT_307 = NL + "\t/**" + NL + "\t * Returns a new object of class '<em>";
- protected final String TEXT_308 = "</em>'." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @return a new object of class '<em>";
- protected final String TEXT_309 = "</em>'." + NL + "\t * @generated" + NL + "\t */" + NL + "\t";
- protected final String TEXT_310 = " create";
- protected final String TEXT_311 = "();" + NL;
- protected final String TEXT_312 = NL + " /**" + NL + " * Registers the types supported by this Factory within the supplied scope.argument" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @param scope an instance of HelperContext used to manage the scoping of types." + NL + "\t * @generated" + NL + " */" + NL + " public void register(HelperContext scope);" + NL + " ";
- protected final String TEXT_313 = NL + "\t/**" + NL + "\t * Returns an instance of data type '<em>";
- protected final String TEXT_314 = "</em>' corresponding the given literal." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @param literal a literal of the data type." + NL + "\t * @return a new instance value of the data type." + NL + "\t * @generated" + NL + "\t */" + NL + "\t";
- protected final String TEXT_315 = " create";
- protected final String TEXT_316 = "(String literal);" + NL + "" + NL + "\t/**" + NL + "\t * Returns a literal representation of an instance of data type '<em>";
- protected final String TEXT_317 = "</em>'." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @param instanceValue an instance value of the data type." + NL + "\t * @return a literal representation of the instance value." + NL + "\t * @generated" + NL + "\t */" + NL + "\tString convert";
- protected final String TEXT_318 = "(";
- protected final String TEXT_319 = " instanceValue);" + NL;
- protected final String TEXT_320 = NL + "} //";
- protected final String TEXT_321 = NL;
+ protected final String TEXT_172 = ");";
+ protected final String TEXT_173 = NL + "\t\tsetInstanceProperty (property, \"";
+ protected final String TEXT_174 = "\", ";
+ protected final String TEXT_175 = ", ";
+ protected final String TEXT_176 = ");";
+ protected final String TEXT_177 = NL;
+ protected final String TEXT_178 = NL + "\t\t// Initialize data types";
+ protected final String TEXT_179 = NL + "\t\tinitializeType(";
+ protected final String TEXT_180 = "Type, ";
+ protected final String TEXT_181 = ".class, \"";
+ protected final String TEXT_182 = "\", ";
+ protected final String TEXT_183 = ", ";
+ protected final String TEXT_184 = ");";
+ protected final String TEXT_185 = NL + "\t\tsetInstanceProperty (";
+ protected final String TEXT_186 = "Type, \"";
+ protected final String TEXT_187 = "\", ";
+ protected final String TEXT_188 = ", ";
+ protected final String TEXT_189 = ");";
+ protected final String TEXT_190 = NL;
+ protected final String TEXT_191 = NL + "\t\tcreateXSDMetaData(";
+ protected final String TEXT_192 = ");" + NL + "\t}" + NL + "\t " + NL + "\tprotected void createXSDMetaData(";
+ protected final String TEXT_193 = ")" + NL + "\t{" + NL + "\t\tsuper.initXSD();" + NL + "\t\t" + NL + "\t\t";
+ protected final String TEXT_194 = " property = null;" + NL + "\t\t";
+ protected final String TEXT_195 = NL + "\t\taddXSDMapping" + NL + "\t\t (new String[]" + NL + "\t\t\t {";
+ protected final String TEXT_196 = NL + "\t\t\t ";
+ protected final String TEXT_197 = ", ";
+ protected final String TEXT_198 = NL + "\t\t\t });" + NL;
+ protected final String TEXT_199 = NL;
+ protected final String TEXT_200 = NL + "\t\taddXSDMapping" + NL + "\t\t (";
+ protected final String TEXT_201 = "Type," + NL + "\t\t\t new String[] " + NL + "\t\t\t {";
+ protected final String TEXT_202 = NL + "\t\t\t ";
+ protected final String TEXT_203 = ", ";
+ protected final String TEXT_204 = NL + "\t\t\t });" + NL;
+ protected final String TEXT_205 = NL + "\t\tproperty = createGlobalProperty" + NL + "\t\t (\"";
+ protected final String TEXT_206 = "\"," + NL + "\t\t ";
+ protected final String TEXT_207 = ".get";
+ protected final String TEXT_208 = "()," + NL + "\t\t\t new String[]" + NL + "\t\t\t {";
+ protected final String TEXT_209 = NL + "\t\t\t ";
+ protected final String TEXT_210 = ", ";
+ protected final String TEXT_211 = NL + "\t\t\t }," + NL + "\t\t\t IS_ATTRIBUTE);";
+ protected final String TEXT_212 = NL + "\t\t\t });";
+ protected final String TEXT_213 = NL + " ";
+ protected final String TEXT_214 = NL + "\t\tsetInstanceProperty" + NL + "\t\t (property," + NL + "\t\t\t \"";
+ protected final String TEXT_215 = "\"," + NL + "\t\t\t ";
+ protected final String TEXT_216 = ", ";
+ protected final String TEXT_217 = ");";
+ protected final String TEXT_218 = NL + " ";
+ protected final String TEXT_219 = " ";
+ protected final String TEXT_220 = NL + "\t\taddXSDMapping" + NL + "\t\t\t(getProperty(";
+ protected final String TEXT_221 = "Type, ";
+ protected final String TEXT_222 = ".INTERNAL_";
+ protected final String TEXT_223 = ")," + NL + "\t\t\t new String[]" + NL + "\t\t\t {";
+ protected final String TEXT_224 = NL + "\t\t\t ";
+ protected final String TEXT_225 = ", ";
+ protected final String TEXT_226 = NL + "\t\t\t });" + NL;
+ protected final String TEXT_227 = NL + " }" + NL + " ";
+ protected final String TEXT_228 = NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic ";
+ protected final String TEXT_229 = " create";
+ protected final String TEXT_230 = "FromString(String initialValue)" + NL + "\t{";
+ protected final String TEXT_231 = NL + "\t\t";
+ protected final String TEXT_232 = " result = ";
+ protected final String TEXT_233 = ".get(initialValue);" + NL + "\t\tif (result == null) throw new IllegalArgumentException(\"The value '\" + initialValue + \"' is not a valid enumerator of '\" + type.getName() + \"'\");";
+ protected final String TEXT_234 = NL + "\t\treturn result;";
+ protected final String TEXT_235 = NL + "\t\treturn (";
+ protected final String TEXT_236 = ")create";
+ protected final String TEXT_237 = "FromString(initialValue);";
+ protected final String TEXT_238 = NL + "\t\treturn (";
+ protected final String TEXT_239 = ")";
+ protected final String TEXT_240 = ".create";
+ protected final String TEXT_241 = "FromString(initialValue);";
+ protected final String TEXT_242 = NL + "\t\tif (initialValue == null) return null;" + NL + "\t\t";
+ protected final String TEXT_243 = " result = new ";
+ protected final String TEXT_244 = "();" + NL + "\t\tfor (";
+ protected final String TEXT_245 = " stringTokenizer = new ";
+ protected final String TEXT_246 = "(initialValue); stringTokenizer.hasMoreTokens(); )" + NL + "\t\t{" + NL + "\t\t\tString item = stringTokenizer.nextToken();";
+ protected final String TEXT_247 = NL + "\t\t\tresult.add(create";
+ protected final String TEXT_248 = "FromString(item));";
+ protected final String TEXT_249 = NL + "\t\t\tresult.add(";
+ protected final String TEXT_250 = ".create";
+ protected final String TEXT_251 = "FromString(item));";
+ protected final String TEXT_252 = NL + "\t\t}" + NL + "\t\treturn result;";
+ protected final String TEXT_253 = NL + "\t\tif (initialValue == null) return null;" + NL + "\t\t";
+ protected final String TEXT_254 = " result = null;" + NL + "\t\tRuntimeException exception = null;";
+ protected final String TEXT_255 = NL + "\t\ttry" + NL + "\t\t{";
+ protected final String TEXT_256 = NL + "\t\t\tresult = (";
+ protected final String TEXT_257 = ")create";
+ protected final String TEXT_258 = "FromString(initialValue);";
+ protected final String TEXT_259 = NL + "\t\t\tresult = (";
+ protected final String TEXT_260 = ")";
+ protected final String TEXT_261 = ".create";
+ protected final String TEXT_262 = "FromString(initialValue);";
+ protected final String TEXT_263 = NL + "\t\t\tif (result != null/* && Diagnostician.INSTANCE.validate(type, result, null, null)*/)" + NL + "\t\t\t{" + NL + "\t\t\t\treturn result;" + NL + "\t\t\t}" + NL + "\t\t}" + NL + "\t\tcatch (RuntimeException e)" + NL + "\t\t{" + NL + "\t\t\texception = e;" + NL + "\t\t}";
+ protected final String TEXT_264 = NL + "\t\tif (result != null || exception == null) return result;" + NL + " " + NL + "\t\tthrow exception;";
+ protected final String TEXT_265 = NL + "\t\t// TODO: implement this method" + NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new ";
+ protected final String TEXT_266 = "();";
+ protected final String TEXT_267 = NL + "\t\treturn (";
+ protected final String TEXT_268 = ")super.createFromString(";
+ protected final String TEXT_269 = ", initialValue);";
+ protected final String TEXT_270 = NL + "\t}" + NL + "" + NL + "\t/**" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @generated" + NL + "\t */" + NL + "\tpublic String convert";
+ protected final String TEXT_271 = "ToString(Object instanceValue)" + NL + "\t{";
+ protected final String TEXT_272 = NL + "\t\treturn instanceValue == null ? null : instanceValue.toString();";
+ protected final String TEXT_273 = NL + "\t\treturn convert";
+ protected final String TEXT_274 = "ToString(instanceValue);";
+ protected final String TEXT_275 = NL + "\t\treturn ";
+ protected final String TEXT_276 = ".convert";
+ protected final String TEXT_277 = "ToString(instanceValue);";
+ protected final String TEXT_278 = NL + "\t\tif (instanceValue == null) return null;" + NL + "\t\t";
+ protected final String TEXT_279 = " list = (";
+ protected final String TEXT_280 = ")instanceValue;" + NL + "\t\tif (list.isEmpty()) return \"\";" + NL + "\t\t";
+ protected final String TEXT_281 = " result = new ";
+ protected final String TEXT_282 = "();" + NL + "\t\tfor (";
+ protected final String TEXT_283 = " i = list.iterator(); i.hasNext(); )" + NL + "\t\t{";
+ protected final String TEXT_284 = NL + "\t\t\tresult.append(convert";
+ protected final String TEXT_285 = "ToString(i.next()));";
+ protected final String TEXT_286 = NL + "\t\t\tresult.append(";
+ protected final String TEXT_287 = ".convert";
+ protected final String TEXT_288 = "ToString(i.next()));";
+ protected final String TEXT_289 = NL + "\t\t\tresult.append(' ');" + NL + "\t\t}" + NL + "\t\treturn result.substring(0, result.length() - 1);";
+ protected final String TEXT_290 = NL + "\t\tif (instanceValue == null) return null;";
+ protected final String TEXT_291 = NL + "\t\tif (";
+ protected final String TEXT_292 = ".isInstance(instanceValue))" + NL + "\t\t{" + NL + "\t\t\ttry" + NL + "\t\t\t{";
+ protected final String TEXT_293 = NL + "\t\t\t\tString value = convert";
+ protected final String TEXT_294 = "ToString(instanceValue);";
+ protected final String TEXT_295 = NL + "\t\t\t\tString value = ";
+ protected final String TEXT_296 = ".convert";
+ protected final String TEXT_297 = "ToString(instanceValue);";
+ protected final String TEXT_298 = NL + "\t\t\t\tif (value != null) return value;" + NL + "\t\t\t}" + NL + "\t\t\tcatch (Exception e)" + NL + "\t\t\t{" + NL + "\t\t\t}" + NL + "\t\t}";
+ protected final String TEXT_299 = NL + "\t\tthrow new IllegalArgumentException(\"Invalid value: '\"+instanceValue+\"' for datatype :";
+ protected final String TEXT_300 = "\");";
+ protected final String TEXT_301 = NL + "\t\t// TODO: implement this method" + NL + "\t\t// Ensure that you remove @generated or mark it @generated NOT" + NL + "\t\tthrow new ";
+ protected final String TEXT_302 = "();";
+ protected final String TEXT_303 = NL + "\t\treturn super.convertToString(";
+ protected final String TEXT_304 = ", instanceValue);";
+ protected final String TEXT_305 = NL + "\t}" + NL;
+ protected final String TEXT_306 = NL + "\t/**" + NL + "\t * Returns a new object of class '<em>";
+ protected final String TEXT_307 = "</em>'." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @return a new object of class '<em>";
+ protected final String TEXT_308 = "</em>'." + NL + "\t * @generated" + NL + "\t */" + NL + "\t";
+ protected final String TEXT_309 = " create";
+ protected final String TEXT_310 = "();" + NL;
+ protected final String TEXT_311 = NL + " /**" + NL + " * Registers the types supported by this Factory within the supplied scope.argument" + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @param scope an instance of HelperContext used to manage the scoping of types." + NL + "\t * @generated" + NL + " */" + NL + " public void register(HelperContext scope);" + NL + " ";
+ protected final String TEXT_312 = NL + "\t/**" + NL + "\t * Returns an instance of data type '<em>";
+ protected final String TEXT_313 = "</em>' corresponding the given literal." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @param literal a literal of the data type." + NL + "\t * @return a new instance value of the data type." + NL + "\t * @generated" + NL + "\t */" + NL + "\t";
+ protected final String TEXT_314 = " create";
+ protected final String TEXT_315 = "(String literal);" + NL + "" + NL + "\t/**" + NL + "\t * Returns a literal representation of an instance of data type '<em>";
+ protected final String TEXT_316 = "</em>'." + NL + "\t * <!-- begin-user-doc -->" + NL + "\t * <!-- end-user-doc -->" + NL + "\t * @param instanceValue an instance value of the data type." + NL + "\t * @return a literal representation of the instance value." + NL + "\t * @generated" + NL + "\t */" + NL + "\tString convert";
+ protected final String TEXT_317 = "(";
+ protected final String TEXT_318 = " instanceValue);" + NL;
+ protected final String TEXT_319 = NL + "} //";
+ protected final String TEXT_320 = NL;
public String generate(Object argument)
{
@@ -386,7 +385,7 @@
GenPackage genPackage = (GenPackage)((Object[])argument)[0]; GenModel genModel=genPackage.getGenModel();
boolean isInterface = Boolean.TRUE.equals(((Object[])argument)[1]); boolean isImplementation = Boolean.TRUE.equals(((Object[])argument)[2]);
- String factoryPatternVersion = "1.1";
+ String factoryPatternVersion = "1.2";
String publicStaticFinalFlag = isImplementation ? "public static final " : "";
stringBuffer.append(TEXT_1);
stringBuffer.append(TEXT_2);
@@ -738,419 +737,417 @@
stringBuffer.append(TEXT_148);
stringBuffer.append(genClass.getSafeUncapName());
stringBuffer.append(TEXT_149);
- stringBuffer.append(genClass.getClassName());
+ stringBuffer.append(genClass.getLocalFeatureIndex(genFeature));
stringBuffer.append(TEXT_150);
- stringBuffer.append(genFeature.getUpperName());
- stringBuffer.append(TEXT_151);
if (genFeature.isReferenceType()) { GenFeature reverseGenFeature = genFeature.getReverse();
String reverse = reverseGenFeature == null ? "null" : genPackage.getPackageInstanceVariable(reverseGenFeature.getGenPackage()) + ".get" + reverseGenFeature.getFeatureAccessorName() + "()";
- stringBuffer.append(TEXT_152);
+ stringBuffer.append(TEXT_151);
stringBuffer.append(type);
- stringBuffer.append(TEXT_153);
+ stringBuffer.append(TEXT_152);
stringBuffer.append(genFeature.getName());
- stringBuffer.append(TEXT_154);
+ stringBuffer.append(TEXT_153);
stringBuffer.append(genFeature.getDefaultValue());
- stringBuffer.append(TEXT_155);
+ stringBuffer.append(TEXT_154);
stringBuffer.append(genFeature.getLowerBound());
- stringBuffer.append(TEXT_156);
+ stringBuffer.append(TEXT_155);
stringBuffer.append(genFeature.getUpperBound());
- stringBuffer.append(TEXT_157);
+ stringBuffer.append(TEXT_156);
stringBuffer.append(genFeature.getContainerClass());
- stringBuffer.append(TEXT_158);
+ stringBuffer.append(TEXT_157);
stringBuffer.append(genFeature.getChangeableFlag().equals("IS_CHANGEABLE") ? "false" : "true");
- stringBuffer.append(TEXT_159);
+ stringBuffer.append(TEXT_158);
stringBuffer.append(genFeature.getUnsettableFlag().equals("IS_UNSETTABLE") ? "true": "false");
- stringBuffer.append(TEXT_160);
+ stringBuffer.append(TEXT_159);
stringBuffer.append(genFeature.getDerivedFlag().equals("IS_DERIVED") ? "true" : "false");
- stringBuffer.append(TEXT_161);
+ stringBuffer.append(TEXT_160);
stringBuffer.append(genFeature.getContainmentFlag().equals("IS_COMPOSITE")? "true": "false");
- stringBuffer.append(TEXT_162);
+ stringBuffer.append(TEXT_161);
stringBuffer.append(reverse);
- stringBuffer.append(TEXT_163);
+ stringBuffer.append(TEXT_162);
}else{
- stringBuffer.append(TEXT_164);
+ stringBuffer.append(TEXT_163);
stringBuffer.append(type);
- stringBuffer.append(TEXT_165);
+ stringBuffer.append(TEXT_164);
stringBuffer.append(genFeature.getName());
- stringBuffer.append(TEXT_166);
+ stringBuffer.append(TEXT_165);
stringBuffer.append(genFeature.getDefaultValue());
- stringBuffer.append(TEXT_167);
+ stringBuffer.append(TEXT_166);
stringBuffer.append(genFeature.getLowerBound());
- stringBuffer.append(TEXT_168);
+ stringBuffer.append(TEXT_167);
stringBuffer.append(genFeature.getUpperBound());
- stringBuffer.append(TEXT_169);
+ stringBuffer.append(TEXT_168);
stringBuffer.append(genFeature.getContainerClass());
- stringBuffer.append(TEXT_170);
+ stringBuffer.append(TEXT_169);
stringBuffer.append(genFeature.getChangeableFlag().equals("IS_CHANGEABLE") ? "false" : "true");
- stringBuffer.append(TEXT_171);
+ stringBuffer.append(TEXT_170);
stringBuffer.append(genFeature.getUnsettableFlag().equals("IS_UNSETTABLE") ? "true": "false");
- stringBuffer.append(TEXT_172);
+ stringBuffer.append(TEXT_171);
stringBuffer.append(genFeature.getDerivedFlag().equals("IS_DERIVED") ? "true" : "false");
- stringBuffer.append(TEXT_173);
+ stringBuffer.append(TEXT_172);
}
for (Iterator sources = annotationSources.iterator(); sources.hasNext();) { String annotationSource = (String)sources.next();
EAnnotation featureAnnotation = genFeature.getEcoreFeature().getEAnnotation(annotationSource);
if (featureAnnotation != null) {
for (Iterator k = featureAnnotation.getDetails().iterator(); k.hasNext();) { Map.Entry detail = (Map.Entry)k.next(); String key = Literals.toStringLiteral((String)detail.getKey(), genModel); String value = Literals.toStringLiteral((String)detail.getValue(), genModel);
- stringBuffer.append(TEXT_174);
+ stringBuffer.append(TEXT_173);
stringBuffer.append(annotationSource);
- stringBuffer.append(TEXT_175);
+ stringBuffer.append(TEXT_174);
stringBuffer.append(key);
- stringBuffer.append(TEXT_176);
+ stringBuffer.append(TEXT_175);
stringBuffer.append(value);
stringBuffer.append(genModel.getNonNLS(key + value));
- stringBuffer.append(TEXT_177);
+ stringBuffer.append(TEXT_176);
}
}
}
- stringBuffer.append(TEXT_178);
+ stringBuffer.append(TEXT_177);
}
}
}
if (!genPackage.getGenDataTypes().isEmpty()) {
- stringBuffer.append(TEXT_179);
+ stringBuffer.append(TEXT_178);
for (Iterator d=genPackage.getGenDataTypes().iterator(); d.hasNext();) { GenDataType genDataType = (GenDataType)d.next();
- stringBuffer.append(TEXT_180);
+ stringBuffer.append(TEXT_179);
stringBuffer.append(genDataType.getSafeUncapName());
- stringBuffer.append(TEXT_181);
+ stringBuffer.append(TEXT_180);
stringBuffer.append(genDataType.getImportedInstanceClassName());
- stringBuffer.append(TEXT_182);
+ stringBuffer.append(TEXT_181);
stringBuffer.append(genDataType.getName());
- stringBuffer.append(TEXT_183);
+ stringBuffer.append(TEXT_182);
stringBuffer.append(genDataType.getSerializableFlag().equals("IS_SERIALIZABLE") ? "true" : "false");
- stringBuffer.append(TEXT_184);
+ stringBuffer.append(TEXT_183);
stringBuffer.append(genDataType.getGeneratedInstanceClassFlag().equals("IS_GENERATED_INSTANCE_CLASS") ? "true" : "false" );
- stringBuffer.append(TEXT_185);
+ stringBuffer.append(TEXT_184);
stringBuffer.append(genModel.getNonNLS());
for (Iterator sources = annotationSources.iterator(); sources.hasNext();) { String annotationSource = (String)sources.next();
EAnnotation dataTypeAnnotation = genDataType.getEcoreDataType().getEAnnotation(annotationSource);
if (dataTypeAnnotation != null) {
for (Iterator k = dataTypeAnnotation.getDetails().iterator(); k.hasNext();) { Map.Entry detail = (Map.Entry)k.next(); String key = Literals.toStringLiteral((String)detail.getKey(), genModel); String value = Literals.toStringLiteral((String)detail.getValue(), genModel);
- stringBuffer.append(TEXT_186);
+ stringBuffer.append(TEXT_185);
stringBuffer.append(genDataType.getSafeUncapName());
- stringBuffer.append(TEXT_187);
+ stringBuffer.append(TEXT_186);
stringBuffer.append(annotationSource);
- stringBuffer.append(TEXT_188);
+ stringBuffer.append(TEXT_187);
stringBuffer.append(key);
- stringBuffer.append(TEXT_189);
+ stringBuffer.append(TEXT_188);
stringBuffer.append(value);
stringBuffer.append(genModel.getNonNLS(key + value));
- stringBuffer.append(TEXT_190);
+ stringBuffer.append(TEXT_189);
}
}
}
- stringBuffer.append(TEXT_191);
+ stringBuffer.append(TEXT_190);
}
}
- stringBuffer.append(TEXT_192);
+ stringBuffer.append(TEXT_191);
stringBuffer.append(SDOGenUtil.getDependentFactoryArgumentList(genPackage, false));
- stringBuffer.append(TEXT_193);
+ stringBuffer.append(TEXT_192);
stringBuffer.append(SDOGenUtil.getDependentFactoryArgumentList(genPackage, true));
- stringBuffer.append(TEXT_194);
+ stringBuffer.append(TEXT_193);
stringBuffer.append(genModel.getImportedName("commonj.sdo.Property"));
- stringBuffer.append(TEXT_195);
+ stringBuffer.append(TEXT_194);
String extendedMetaDataSource = ExtendedMetaData.ANNOTATION_URI;
EAnnotation packageAnnotation = genPackage.getEcorePackage().getEAnnotation(extendedMetaDataSource);
if (packageAnnotation != null){
- stringBuffer.append(TEXT_196);
+ stringBuffer.append(TEXT_195);
for (Iterator k = packageAnnotation.getDetails().iterator(); k.hasNext();) { Map.Entry detail = (Map.Entry)k.next(); String key = Literals.toStringLiteral((String)detail.getKey(), genModel); String value = Literals.toStringLiteral((String)detail.getValue(), genModel);
- stringBuffer.append(TEXT_197);
+ stringBuffer.append(TEXT_196);
stringBuffer.append(key);
- stringBuffer.append(TEXT_198);
+ stringBuffer.append(TEXT_197);
stringBuffer.append(value);
stringBuffer.append(k.hasNext() ? "," : "");
stringBuffer.append(genModel.getNonNLS(key + value));
}
- stringBuffer.append(TEXT_199);
+ stringBuffer.append(TEXT_198);
}
- stringBuffer.append(TEXT_200);
+ stringBuffer.append(TEXT_199);
for (Iterator i=genPackage.getGenClassifiers().iterator(); i.hasNext();) { GenClassifier genClassifier = (GenClassifier)i.next(); EAnnotation classAnnotation = genClassifier.getEcoreClassifier().getEAnnotation(extendedMetaDataSource);
if (classAnnotation != null && !genClassifier.getName().equals("DocumentRoot")) {
- stringBuffer.append(TEXT_201);
+ stringBuffer.append(TEXT_200);
stringBuffer.append(genClassifier.getSafeUncapName());
- stringBuffer.append(TEXT_202);
+ stringBuffer.append(TEXT_201);
for (Iterator k = classAnnotation.getDetails().iterator(); k.hasNext();) { Map.Entry detail = (Map.Entry)k.next(); String key = Literals.toStringLiteral((String)detail.getKey(), genModel); String value = Literals.toStringLiteral((String)detail.getValue(), genModel);
- stringBuffer.append(TEXT_203);
+ stringBuffer.append(TEXT_202);
stringBuffer.append(key);
- stringBuffer.append(TEXT_204);
+ stringBuffer.append(TEXT_203);
stringBuffer.append(value);
stringBuffer.append(k.hasNext() ? "," : "");
stringBuffer.append(genModel.getNonNLS(key + value));
}
- stringBuffer.append(TEXT_205);
+ stringBuffer.append(TEXT_204);
}
if (genClassifier instanceof GenClass) { GenClass genClass = (GenClass) genClassifier;
for (Iterator j=genClass.getGenFeatures().iterator(); j.hasNext();) { GenFeature genFeature = (GenFeature)j.next();
EAnnotation featureAnnotation = genFeature.getEcoreFeature().getEAnnotation(extendedMetaDataSource);
if (genClass.getName().equals("DocumentRoot")) {
if (!(genFeature.getName().equals("mixed") || genFeature.getName().equals("xMLNSPrefixMap") || genFeature.getName().equals("xSISchemaLocation"))) {
- stringBuffer.append(TEXT_206);
+ stringBuffer.append(TEXT_205);
stringBuffer.append(genFeature.getName());
- stringBuffer.append(TEXT_207);
+ stringBuffer.append(TEXT_206);
stringBuffer.append(genPackage.getPackageInstanceVariable(genFeature.getTypeGenPackage()));
- stringBuffer.append(TEXT_208);
+ stringBuffer.append(TEXT_207);
stringBuffer.append(genFeature.getTypeClassifierAccessorName());
- stringBuffer.append(TEXT_209);
+ stringBuffer.append(TEXT_208);
for (Iterator k = featureAnnotation.getDetails().iterator(); k.hasNext();) { Map.Entry detail = (Map.Entry)k.next(); String key = Literals.toStringLiteral((String)detail.getKey(), genModel); String value = Literals.toStringLiteral((String)detail.getValue(), genModel);
- stringBuffer.append(TEXT_210);
+ stringBuffer.append(TEXT_209);
stringBuffer.append(key);
- stringBuffer.append(TEXT_211);
+ stringBuffer.append(TEXT_210);
stringBuffer.append(value);
stringBuffer.append(k.hasNext() ? "," : "");
stringBuffer.append(genModel.getNonNLS(key + value));
}
if (!genFeature.isReferenceType()) {
- stringBuffer.append(TEXT_212);
+ stringBuffer.append(TEXT_211);
} else {
- stringBuffer.append(TEXT_213);
+ stringBuffer.append(TEXT_212);
}
- stringBuffer.append(TEXT_214);
+ stringBuffer.append(TEXT_213);
for (Iterator sources = genPackage.getAnnotationSources().iterator(); sources.hasNext();) { String annotationSource = (String)sources.next();
if (!annotationSource.equals(extendedMetaDataSource)) {
EAnnotation globalAnnotation = genFeature.getEcoreFeature().getEAnnotation(annotationSource);
if (globalAnnotation != null) {
for (Iterator k = globalAnnotation.getDetails().iterator(); k.hasNext();) { Map.Entry detail = (Map.Entry)k.next(); String key = Literals.toStringLiteral((String)detail.getKey(), genModel); String value = Literals.toStringLiteral((String)detail.getValue(), genModel);
- stringBuffer.append(TEXT_215);
+ stringBuffer.append(TEXT_214);
stringBuffer.append(annotationSource);
- stringBuffer.append(TEXT_216);
+ stringBuffer.append(TEXT_215);
stringBuffer.append(key);
- stringBuffer.append(TEXT_217);
+ stringBuffer.append(TEXT_216);
stringBuffer.append(value);
stringBuffer.append(genModel.getNonNLS(key + value));
- stringBuffer.append(TEXT_218);
+ stringBuffer.append(TEXT_217);
}
- stringBuffer.append(TEXT_219);
+ stringBuffer.append(TEXT_218);
}
}
- stringBuffer.append(TEXT_220);
+ stringBuffer.append(TEXT_219);
}
}
} else {
- stringBuffer.append(TEXT_221);
+ stringBuffer.append(TEXT_220);
stringBuffer.append(genClassifier.getSafeUncapName());
- stringBuffer.append(TEXT_222);
+ stringBuffer.append(TEXT_221);
stringBuffer.append(genClass.getClassName());
- stringBuffer.append(TEXT_223);
+ stringBuffer.append(TEXT_222);
stringBuffer.append(genFeature.getUpperName());
- stringBuffer.append(TEXT_224);
+ stringBuffer.append(TEXT_223);
for (Iterator k = featureAnnotation.getDetails().iterator(); k.hasNext();) { Map.Entry detail = (Map.Entry)k.next(); String key = Literals.toStringLiteral((String)detail.getKey(), genModel); String value = Literals.toStringLiteral((String)detail.getValue(), genModel);
- stringBuffer.append(TEXT_225);
+ stringBuffer.append(TEXT_224);
stringBuffer.append(key);
- stringBuffer.append(TEXT_226);
+ stringBuffer.append(TEXT_225);
stringBuffer.append(value);
stringBuffer.append(k.hasNext() ? "," : "");
stringBuffer.append(genModel.getNonNLS(key + value));
}
- stringBuffer.append(TEXT_227);
+ stringBuffer.append(TEXT_226);
}
}
}
}
- stringBuffer.append(TEXT_228);
+ stringBuffer.append(TEXT_227);
for (Iterator i=genPackage.getAllGenDataTypes().iterator(); i.hasNext();) { GenDataType genDataType = (GenDataType)i.next();
if (genDataType.isSerializable()) {
- stringBuffer.append(TEXT_229);
+ stringBuffer.append(TEXT_228);
stringBuffer.append(genDataType.getObjectInstanceClassName());
- stringBuffer.append(TEXT_230);
+ stringBuffer.append(TEXT_229);
stringBuffer.append(genDataType.getName());
- stringBuffer.append(TEXT_231);
+ stringBuffer.append(TEXT_230);
if (genDataType instanceof GenEnum) {
+ stringBuffer.append(TEXT_231);
+ stringBuffer.append(((GenEnum)genDataType).getImportedInstanceClassName());
stringBuffer.append(TEXT_232);
stringBuffer.append(((GenEnum)genDataType).getImportedInstanceClassName());
stringBuffer.append(TEXT_233);
- stringBuffer.append(((GenEnum)genDataType).getImportedInstanceClassName());
- stringBuffer.append(TEXT_234);
stringBuffer.append(genModel.getNonNLS());
stringBuffer.append(genModel.getNonNLS(2));
stringBuffer.append(genModel.getNonNLS(3));
- stringBuffer.append(TEXT_235);
+ stringBuffer.append(TEXT_234);
} else if (genDataType.getBaseType() != null) { GenDataType genBaseType = genDataType.getBaseType();
if (genBaseType.getGenPackage() == genPackage) {
- stringBuffer.append(TEXT_236);
+ stringBuffer.append(TEXT_235);
stringBuffer.append(genDataType.getObjectInstanceClassName());
- stringBuffer.append(TEXT_237);
+ stringBuffer.append(TEXT_236);
stringBuffer.append(genBaseType.getName());
- stringBuffer.append(TEXT_238);
+ stringBuffer.append(TEXT_237);
} else {
- stringBuffer.append(TEXT_239);
+ stringBuffer.append(TEXT_238);
stringBuffer.append(genDataType.getObjectInstanceClassName());
- stringBuffer.append(TEXT_240);
+ stringBuffer.append(TEXT_239);
stringBuffer.append(SDOGenUtil.getFactoryImpl(genBaseType.getGenPackage()));
- stringBuffer.append(TEXT_241);
+ stringBuffer.append(TEXT_240);
stringBuffer.append(genBaseType.getName());
- stringBuffer.append(TEXT_242);
+ stringBuffer.append(TEXT_241);
}
} else if (genDataType.getItemType() != null) { GenDataType genItemType = genDataType.getItemType();
- stringBuffer.append(TEXT_243);
+ stringBuffer.append(TEXT_242);
stringBuffer.append(genModel.getImportedName("java.util.List"));
- stringBuffer.append(TEXT_244);
+ stringBuffer.append(TEXT_243);
stringBuffer.append(genModel.getImportedName("java.util.ArrayList"));
+ stringBuffer.append(TEXT_244);
+ stringBuffer.append(genModel.getImportedName("java.util.StringTokenizer"));
stringBuffer.append(TEXT_245);
stringBuffer.append(genModel.getImportedName("java.util.StringTokenizer"));
stringBuffer.append(TEXT_246);
- stringBuffer.append(genModel.getImportedName("java.util.StringTokenizer"));
- stringBuffer.append(TEXT_247);
if (genItemType.getGenPackage() == genPackage) {
- stringBuffer.append(TEXT_248);
+ stringBuffer.append(TEXT_247);
stringBuffer.append(genItemType.getName());
- stringBuffer.append(TEXT_249);
+ stringBuffer.append(TEXT_248);
} else {
- stringBuffer.append(TEXT_250);
+ stringBuffer.append(TEXT_249);
stringBuffer.append(SDOGenUtil.getFactoryImpl(genItemType.getGenPackage()));
- stringBuffer.append(TEXT_251);
+ stringBuffer.append(TEXT_250);
stringBuffer.append(genItemType.getName());
- stringBuffer.append(TEXT_252);
+ stringBuffer.append(TEXT_251);
}
- stringBuffer.append(TEXT_253);
+ stringBuffer.append(TEXT_252);
} else if (!genDataType.getMemberTypes().isEmpty()) {
- stringBuffer.append(TEXT_254);
+ stringBuffer.append(TEXT_253);
stringBuffer.append(genDataType.getObjectInstanceClassName());
- stringBuffer.append(TEXT_255);
+ stringBuffer.append(TEXT_254);
for (Iterator j = genDataType.getMemberTypes().iterator(); j.hasNext(); ) { GenDataType genMemberType = (GenDataType)j.next();
- stringBuffer.append(TEXT_256);
+ stringBuffer.append(TEXT_255);
if (genMemberType.getGenPackage() == genPackage) {
- stringBuffer.append(TEXT_257);
+ stringBuffer.append(TEXT_256);
stringBuffer.append(genDataType.getObjectInstanceClassName());
- stringBuffer.append(TEXT_258);
+ stringBuffer.append(TEXT_257);
stringBuffer.append(genMemberType.getName());
- stringBuffer.append(TEXT_259);
+ stringBuffer.append(TEXT_258);
} else {
- stringBuffer.append(TEXT_260);
+ stringBuffer.append(TEXT_259);
stringBuffer.append(genDataType.getObjectInstanceClassName());
- stringBuffer.append(TEXT_261);
+ stringBuffer.append(TEXT_260);
stringBuffer.append(SDOGenUtil.getFactoryImpl(genMemberType.getGenPackage()));
- stringBuffer.append(TEXT_262);
+ stringBuffer.append(TEXT_261);
stringBuffer.append(genMemberType.getName());
+ stringBuffer.append(TEXT_262);
+ }
stringBuffer.append(TEXT_263);
}
stringBuffer.append(TEXT_264);
- }
- stringBuffer.append(TEXT_265);
} else if (genDataType.isArrayType()) {
- stringBuffer.append(TEXT_266);
+ stringBuffer.append(TEXT_265);
stringBuffer.append(genModel.getImportedName("java.lang.UnsupportedOperationException"));
- stringBuffer.append(TEXT_267);
+ stringBuffer.append(TEXT_266);
} else {
- stringBuffer.append(TEXT_268);
+ stringBuffer.append(TEXT_267);
stringBuffer.append(genDataType.getObjectInstanceClassName());
- stringBuffer.append(TEXT_269);
+ stringBuffer.append(TEXT_268);
stringBuffer.append(genDataType.getClassifierID());
- stringBuffer.append(TEXT_270);
+ stringBuffer.append(TEXT_269);
}
- stringBuffer.append(TEXT_271);
+ stringBuffer.append(TEXT_270);
stringBuffer.append(genDataType.getName());
- stringBuffer.append(TEXT_272);
+ stringBuffer.append(TEXT_271);
if (genDataType instanceof GenEnum) {
- stringBuffer.append(TEXT_273);
+ stringBuffer.append(TEXT_272);
} else if (genDataType.getBaseType() != null) { GenDataType genBaseType = genDataType.getBaseType();
if (genBaseType.getGenPackage() == genPackage) {
- stringBuffer.append(TEXT_274);
+ stringBuffer.append(TEXT_273);
stringBuffer.append(genBaseType.getName());
- stringBuffer.append(TEXT_275);
+ stringBuffer.append(TEXT_274);
} else {
- stringBuffer.append(TEXT_276);
+ stringBuffer.append(TEXT_275);
stringBuffer.append(SDOGenUtil.getFactoryImpl(genBaseType.getGenPackage()));
- stringBuffer.append(TEXT_277);
+ stringBuffer.append(TEXT_276);
stringBuffer.append(genBaseType.getName());
- stringBuffer.append(TEXT_278);
+ stringBuffer.append(TEXT_277);
}
} else if (genDataType.getItemType() != null) { GenDataType genItemType = genDataType.getItemType();
+ stringBuffer.append(TEXT_278);
+ stringBuffer.append(genModel.getImportedName("java.util.List"));
stringBuffer.append(TEXT_279);
stringBuffer.append(genModel.getImportedName("java.util.List"));
stringBuffer.append(TEXT_280);
- stringBuffer.append(genModel.getImportedName("java.util.List"));
+ stringBuffer.append(genModel.getImportedName("java.lang.StringBuffer"));
stringBuffer.append(TEXT_281);
stringBuffer.append(genModel.getImportedName("java.lang.StringBuffer"));
stringBuffer.append(TEXT_282);
- stringBuffer.append(genModel.getImportedName("java.lang.StringBuffer"));
- stringBuffer.append(TEXT_283);
stringBuffer.append(genModel.getImportedName("java.util.Iterator"));
- stringBuffer.append(TEXT_284);
+ stringBuffer.append(TEXT_283);
if (genItemType.getGenPackage() == genPackage) {
- stringBuffer.append(TEXT_285);
+ stringBuffer.append(TEXT_284);
stringBuffer.append(genItemType.getName());
- stringBuffer.append(TEXT_286);
+ stringBuffer.append(TEXT_285);
} else {
- stringBuffer.append(TEXT_287);
+ stringBuffer.append(TEXT_286);
stringBuffer.append(SDOGenUtil.getFactoryImpl(genItemType.getGenPackage()));
- stringBuffer.append(TEXT_288);
+ stringBuffer.append(TEXT_287);
stringBuffer.append(genItemType.getName());
- stringBuffer.append(TEXT_289);
+ stringBuffer.append(TEXT_288);
}
- stringBuffer.append(TEXT_290);
+ stringBuffer.append(TEXT_289);
} else if (!genDataType.getMemberTypes().isEmpty()) {
- stringBuffer.append(TEXT_291);
+ stringBuffer.append(TEXT_290);
for (Iterator j = genDataType.getMemberTypes().iterator(); j.hasNext(); ) { GenDataType genMemberType = (GenDataType)j.next();
- stringBuffer.append(TEXT_292);
+ stringBuffer.append(TEXT_291);
stringBuffer.append(SDOGenUtil.getQualifiedTypeAccessor(genMemberType));
- stringBuffer.append(TEXT_293);
+ stringBuffer.append(TEXT_292);
if (genMemberType.getGenPackage() == genPackage) {
- stringBuffer.append(TEXT_294);
+ stringBuffer.append(TEXT_293);
stringBuffer.append(genMemberType.getName());
- stringBuffer.append(TEXT_295);
+ stringBuffer.append(TEXT_294);
} else {
- stringBuffer.append(TEXT_296);
+ stringBuffer.append(TEXT_295);
stringBuffer.append(SDOGenUtil.getFactoryImpl(genMemberType.getGenPackage()));
- stringBuffer.append(TEXT_297);
+ stringBuffer.append(TEXT_296);
stringBuffer.append(genMemberType.getName());
+ stringBuffer.append(TEXT_297);
+ }
stringBuffer.append(TEXT_298);
}
stringBuffer.append(TEXT_299);
- }
- stringBuffer.append(TEXT_300);
stringBuffer.append(genDataType.getName());
- stringBuffer.append(TEXT_301);
+ stringBuffer.append(TEXT_300);
} else if (genDataType.isArrayType()) {
- stringBuffer.append(TEXT_302);
+ stringBuffer.append(TEXT_301);
stringBuffer.append(genModel.getImportedName("java.lang.UnsupportedOperationException"));
- stringBuffer.append(TEXT_303);
+ stringBuffer.append(TEXT_302);
} else {
- stringBuffer.append(TEXT_304);
+ stringBuffer.append(TEXT_303);
stringBuffer.append(genDataType.getClassifierID());
- stringBuffer.append(TEXT_305);
+ stringBuffer.append(TEXT_304);
}
- stringBuffer.append(TEXT_306);
+ stringBuffer.append(TEXT_305);
}
}
} else {
for (Iterator i=genPackage.getGenClasses().iterator(); i.hasNext();) { GenClass genClass = (GenClass)i.next();
if (genClass.hasFactoryInterfaceCreateMethod()) {
+ stringBuffer.append(TEXT_306);
+ stringBuffer.append(genClass.getFormattedName());
stringBuffer.append(TEXT_307);
stringBuffer.append(genClass.getFormattedName());
stringBuffer.append(TEXT_308);
- stringBuffer.append(genClass.getFormattedName());
- stringBuffer.append(TEXT_309);
stringBuffer.append(genClass.getImportedInterfaceName());
- stringBuffer.append(TEXT_310);
+ stringBuffer.append(TEXT_309);
stringBuffer.append(genClass.getName());
- stringBuffer.append(TEXT_311);
+ stringBuffer.append(TEXT_310);
}
}
- stringBuffer.append(TEXT_312);
+ stringBuffer.append(TEXT_311);
if (genPackage.isDataTypeConverters()) {
for (Iterator i=genPackage.getAllGenDataTypes().iterator(); i.hasNext();) { GenDataType genDataType = (GenDataType)i.next();
if (genDataType.isSerializable()) {
- stringBuffer.append(TEXT_313);
+ stringBuffer.append(TEXT_312);
stringBuffer.append(genDataType.getFormattedName());
- stringBuffer.append(TEXT_314);
+ stringBuffer.append(TEXT_313);
stringBuffer.append(genDataType.getImportedInstanceClassName());
- stringBuffer.append(TEXT_315);
+ stringBuffer.append(TEXT_314);
stringBuffer.append(genDataType.getName());
- stringBuffer.append(TEXT_316);
+ stringBuffer.append(TEXT_315);
stringBuffer.append(genDataType.getFormattedName());
- stringBuffer.append(TEXT_317);
+ stringBuffer.append(TEXT_316);
stringBuffer.append(genDataType.getName());
- stringBuffer.append(TEXT_318);
+ stringBuffer.append(TEXT_317);
stringBuffer.append(genDataType.getImportedInstanceClassName());
- stringBuffer.append(TEXT_319);
+ stringBuffer.append(TEXT_318);
}
}
}
}
- stringBuffer.append(TEXT_320);
+ stringBuffer.append(TEXT_319);
stringBuffer.append(isInterface ? genPackage.getFactoryInterfaceName() : genPackage.getFactoryClassName());
genModel.emitSortedImports();
- stringBuffer.append(TEXT_321);
+ stringBuffer.append(TEXT_320);
return stringBuffer.toString();
}
}
Added: incubator/tuscany/java/sdo/tools/src/test/java/com/example/customer/Account.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/tools/src/test/java/com/example/customer/Account.java?view=auto&rev=542588
==============================================================================
--- incubator/tuscany/java/sdo/tools/src/test/java/com/example/customer/Account.java (added)
+++ incubator/tuscany/java/sdo/tools/src/test/java/com/example/customer/Account.java Tue May 29 09:53:20 2007
@@ -0,0 +1,93 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.example.customer;
+
+import java.io.Serializable;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Account</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link com.example.customer.Account#getAccountNum <em>Account Num</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @extends Serializable
+ * @generated
+ */
+public interface Account extends Serializable
+{
+ /**
+ * Returns the value of the '<em><b>Account Num</b></em>' attribute.
+ * The default value is <code>"0"</code>.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Account Num</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Account Num</em>' attribute.
+ * @see #isSetAccountNum()
+ * @see #unsetAccountNum()
+ * @see #setAccountNum(int)
+ * @generated
+ */
+ int getAccountNum();
+
+ /**
+ * Sets the value of the '{@link com.example.customer.Account#getAccountNum <em>Account Num</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Account Num</em>' attribute.
+ * @see #isSetAccountNum()
+ * @see #unsetAccountNum()
+ * @see #getAccountNum()
+ * @generated
+ */
+ void setAccountNum(int value);
+
+ /**
+ * Unsets the value of the '{@link com.example.customer.Account#getAccountNum <em>Account Num</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isSetAccountNum()
+ * @see #getAccountNum()
+ * @see #setAccountNum(int)
+ * @generated
+ */
+ void unsetAccountNum();
+
+ /**
+ * Returns whether the value of the '{@link com.example.customer.Account#getAccountNum <em>Account Num</em>}' attribute is set.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return whether the value of the '<em>Account Num</em>' attribute is set.
+ * @see #unsetAccountNum()
+ * @see #getAccountNum()
+ * @see #setAccountNum(int)
+ * @generated
+ */
+ boolean isSetAccountNum();
+
+} // Account
Added: incubator/tuscany/java/sdo/tools/src/test/java/com/example/customer/Customer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/tools/src/test/java/com/example/customer/Customer.java?view=auto&rev=542588
==============================================================================
--- incubator/tuscany/java/sdo/tools/src/test/java/com/example/customer/Customer.java (added)
+++ incubator/tuscany/java/sdo/tools/src/test/java/com/example/customer/Customer.java Tue May 29 09:53:20 2007
@@ -0,0 +1,144 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.example.customer;
+
+import java.io.Serializable;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Customer</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link com.example.customer.Customer#getAccount <em>Account</em>}</li>
+ * <li>{@link com.example.customer.Customer#getFirstName <em>First Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @extends Serializable
+ * @generated
+ */
+public interface Customer extends Serializable
+{
+ /**
+ * Returns the value of the '<em><b>Account</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Account</em>' containment reference isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Account</em>' containment reference.
+ * @see #isSetAccount()
+ * @see #unsetAccount()
+ * @see #setAccount(Account)
+ * @generated
+ */
+ Account getAccount();
+
+ /**
+ * Sets the value of the '{@link com.example.customer.Customer#getAccount <em>Account</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Account</em>' containment reference.
+ * @see #isSetAccount()
+ * @see #unsetAccount()
+ * @see #getAccount()
+ * @generated
+ */
+ void setAccount(Account value);
+
+ /**
+ * Unsets the value of the '{@link com.example.customer.Customer#getAccount <em>Account</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isSetAccount()
+ * @see #getAccount()
+ * @see #setAccount(Account)
+ * @generated
+ */
+ void unsetAccount();
+
+ /**
+ * Returns whether the value of the '{@link com.example.customer.Customer#getAccount <em>Account</em>}' containment reference is set.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return whether the value of the '<em>Account</em>' containment reference is set.
+ * @see #unsetAccount()
+ * @see #getAccount()
+ * @see #setAccount(Account)
+ * @generated
+ */
+ boolean isSetAccount();
+
+ /**
+ * Returns the value of the '<em><b>First Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>First Name</em>' attribute isn't clear,
+ * there really should be more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>First Name</em>' attribute.
+ * @see #isSetFirstName()
+ * @see #unsetFirstName()
+ * @see #setFirstName(String)
+ * @generated
+ */
+ String getFirstName();
+
+ /**
+ * Sets the value of the '{@link com.example.customer.Customer#getFirstName <em>First Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>First Name</em>' attribute.
+ * @see #isSetFirstName()
+ * @see #unsetFirstName()
+ * @see #getFirstName()
+ * @generated
+ */
+ void setFirstName(String value);
+
+ /**
+ * Unsets the value of the '{@link com.example.customer.Customer#getFirstName <em>First Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #isSetFirstName()
+ * @see #getFirstName()
+ * @see #setFirstName(String)
+ * @generated
+ */
+ void unsetFirstName();
+
+ /**
+ * Returns whether the value of the '{@link com.example.customer.Customer#getFirstName <em>First Name</em>}' attribute is set.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return whether the value of the '<em>First Name</em>' attribute is set.
+ * @see #unsetFirstName()
+ * @see #getFirstName()
+ * @see #setFirstName(String)
+ * @generated
+ */
+ boolean isSetFirstName();
+
+} // Customer
Added: incubator/tuscany/java/sdo/tools/src/test/java/com/example/customer/CustomerFactory.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/tools/src/test/java/com/example/customer/CustomerFactory.java?view=auto&rev=542588
==============================================================================
--- incubator/tuscany/java/sdo/tools/src/test/java/com/example/customer/CustomerFactory.java (added)
+++ incubator/tuscany/java/sdo/tools/src/test/java/com/example/customer/CustomerFactory.java Tue May 29 09:53:20 2007
@@ -0,0 +1,70 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.example.customer;
+
+import commonj.sdo.helper.HelperContext;
+
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Factory</b> for the model.
+ * It provides a create method for each non-abstract class of the model.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public interface CustomerFactory
+{
+
+ /**
+ * The singleton instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ CustomerFactory INSTANCE = com.example.customer.impl.CustomerFactoryImpl.init();
+
+ /**
+ * Returns a new object of class '<em>Account</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Account</em>'.
+ * @generated
+ */
+ Account createAccount();
+
+ /**
+ * Returns a new object of class '<em>Customer</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @return a new object of class '<em>Customer</em>'.
+ * @generated
+ */
+ Customer createCustomer();
+
+ /**
+ * Registers the types supported by this Factory within the supplied scope.argument
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param scope an instance of HelperContext used to manage the scoping of types.
+ * @generated
+ */
+ public void register(HelperContext scope);
+
+} //CustomerFactory
Added: incubator/tuscany/java/sdo/tools/src/test/java/com/example/customer/impl/AccountImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/tools/src/test/java/com/example/customer/impl/AccountImpl.java?view=auto&rev=542588
==============================================================================
--- incubator/tuscany/java/sdo/tools/src/test/java/com/example/customer/impl/AccountImpl.java (added)
+++ incubator/tuscany/java/sdo/tools/src/test/java/com/example/customer/impl/AccountImpl.java Tue May 29 09:53:20 2007
@@ -0,0 +1,256 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.example.customer.impl;
+
+import com.example.customer.Account;
+import com.example.customer.CustomerFactory;
+
+import commonj.sdo.Type;
+
+import org.apache.tuscany.sdo.impl.DataObjectBase;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model object '<em><b>Account</b></em>'.
+ * <!-- end-user-doc -->
+ * <p>
+ * The following features are implemented:
+ * <ul>
+ * <li>{@link com.example.customer.impl.AccountImpl#getAccountNum <em>Account Num</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @generated
+ */
+public class AccountImpl extends DataObjectBase implements Account
+{
+
+ public final static int ACCOUNT_NUM = 0;
+
+ public final static int SDO_PROPERTY_COUNT = 1;
+
+ public final static int EXTENDED_PROPERTY_COUNT = 0;
+
+
+ /**
+ * The internal feature id for the '<em><b>Account Num</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public final static int INTERNAL_ACCOUNT_NUM = 0;
+
+ /**
+ * The number of properties for this type.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ public final static int INTERNAL_PROPERTY_COUNT = 1;
+
+ protected int internalConvertIndex(int internalIndex)
+ {
+ switch (internalIndex)
+ {
+ case INTERNAL_ACCOUNT_NUM: return ACCOUNT_NUM;
+ }
+ return super.internalConvertIndex(internalIndex);
+ }
+
+
+ /**
+ * The default value of the '{@link #getAccountNum() <em>Account Num</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getAccountNum()
+ * @generated
+ * @ordered
+ */
+ protected static final int ACCOUNT_NUM_DEFAULT_ = 0;
+
+ /**
+ * The cached value of the '{@link #getAccountNum() <em>Account Num</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #getAccountNum()
+ * @generated
+ * @ordered
+ */
+ protected int accountNum = ACCOUNT_NUM_DEFAULT_;
+
+ /**
+ * This is true if the Account Num attribute has been set.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @ordered
+ */
+ protected boolean accountNum_set_ = false;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public AccountImpl()
+ {
+ super();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Type getType()
+ {
+ return ((CustomerFactoryImpl)CustomerFactory.INSTANCE).getAccount();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public int getAccountNum()
+ {
+ return accountNum;
+ }
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void setAccountNum(int newAccountNum)
+ {
+ int oldAccountNum = accountNum;
+ accountNum = newAccountNum;
+ boolean oldAccountNum_set_ = accountNum_set_;
+ accountNum_set_ = true;
+ if (isNotifying())
+ notify(ChangeKind.SET, ACCOUNT_NUM, oldAccountNum, accountNum, !oldAccountNum_set_);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void unsetAccountNum()
+ {
+ int oldAccountNum = accountNum;
+ boolean oldAccountNum_set_ = accountNum_set_;
+ accountNum = ACCOUNT_NUM_DEFAULT_;
+ accountNum_set_ = false;
+ if (isNotifying())
+ notify(ChangeKind.UNSET, ACCOUNT_NUM, oldAccountNum, ACCOUNT_NUM_DEFAULT_, oldAccountNum_set_);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public boolean isSetAccountNum()
+ {
+ return accountNum_set_;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Object get(int propertyIndex, boolean resolve)
+ {
+ switch (propertyIndex)
+ {
+ case ACCOUNT_NUM:
+ return new Integer(getAccountNum());
+ }
+ return super.get(propertyIndex, resolve);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void set(int propertyIndex, Object newValue)
+ {
+ switch (propertyIndex)
+ {
+ case ACCOUNT_NUM:
+ setAccountNum(((Integer)newValue).intValue());
+ return;
+ }
+ super.set(propertyIndex, newValue);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void unset(int propertyIndex)
+ {
+ switch (propertyIndex)
+ {
+ case ACCOUNT_NUM:
+ unsetAccountNum();
+ return;
+ }
+ super.unset(propertyIndex);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public boolean isSet(int propertyIndex)
+ {
+ switch (propertyIndex)
+ {
+ case ACCOUNT_NUM:
+ return isSetAccountNum();
+ }
+ return super.isSet(propertyIndex);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public String toString()
+ {
+ if (isProxy(this)) return super.toString();
+
+ StringBuffer result = new StringBuffer(super.toString());
+ result.append(" (accountNum: ");
+ if (accountNum_set_) result.append(accountNum); else result.append("<unset>");
+ result.append(')');
+ return result.toString();
+ }
+
+} //AccountImpl
Added: incubator/tuscany/java/sdo/tools/src/test/java/com/example/customer/impl/CustomerFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sdo/tools/src/test/java/com/example/customer/impl/CustomerFactoryImpl.java?view=auto&rev=542588
==============================================================================
--- incubator/tuscany/java/sdo/tools/src/test/java/com/example/customer/impl/CustomerFactoryImpl.java (added)
+++ incubator/tuscany/java/sdo/tools/src/test/java/com/example/customer/impl/CustomerFactoryImpl.java Tue May 29 09:53:20 2007
@@ -0,0 +1,300 @@
+/**
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package com.example.customer.impl;
+
+import commonj.sdo.helper.HelperContext;
+import org.apache.tuscany.sdo.helper.TypeHelperImpl;
+
+import com.example.customer.*;
+
+import commonj.sdo.DataObject;
+import commonj.sdo.Property;
+import commonj.sdo.Type;
+
+import org.apache.tuscany.sdo.SDOFactory;
+
+import org.apache.tuscany.sdo.impl.FactoryBase;
+
+import org.apache.tuscany.sdo.model.ModelFactory;
+
+import org.apache.tuscany.sdo.model.impl.ModelFactoryImpl;
+
+import org.apache.tuscany.sdo.model.internal.InternalFactory;
+
+import org.apache.tuscany.sdo.util.SDOUtil;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Factory</b>.
+ * Generator information:
+ * patternVersion=1.2; -prefix Customer
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class CustomerFactoryImpl extends FactoryBase implements CustomerFactory
+{
+
+ /**
+ * The package namespace URI.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String NAMESPACE_URI = "http://example.com/customer";
+
+ /**
+ * The package namespace name.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String NAMESPACE_PREFIX = "stn_1";
+
+ /**
+ * The version of the generator pattern used to generate this class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final String PATTERN_VERSION = "1.2";
+
+ public static final int ACCOUNT = 1;
+ public static final int CUSTOMER = 2;
+
+ /**
+ * Creates an instance of the factory.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public CustomerFactoryImpl()
+ {
+ super(NAMESPACE_URI, NAMESPACE_PREFIX, "com.example.customer");
+ }
+
+ /**
+ * Registers the Factory instance so that it is available within the supplied scope.
+ * @argument scope a HelperContext instance that will make the types supported by this Factory available.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void register(HelperContext scope) {
+ if(scope == null) {
+ throw new IllegalArgumentException("Scope can not be null");
+ }
+ TypeHelperImpl th = (TypeHelperImpl)scope.getTypeHelper();
+ th.getExtendedMetaData().putPackage(NAMESPACE_URI, this);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public DataObject create(int typeNumber)
+ {
+ switch (typeNumber)
+ {
+ case ACCOUNT: return (DataObject)createAccount();
+ case CUSTOMER: return (DataObject)createCustomer();
+ default:
+ return super.create(typeNumber);
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Account createAccount()
+ {
+ AccountImpl account = new AccountImpl();
+ return account;
+ }
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public Customer createCustomer()
+ {
+ CustomerImpl customer = new CustomerImpl();
+ return customer;
+ }
+
+ // Following creates and initializes SDO metadata for the supported types.
+ protected Type accountType = null;
+
+ public Type getAccount()
+ {
+ return accountType;
+ }
+
+ protected Type customerType = null;
+
+ public Type getCustomer()
+ {
+ return customerType;
+ }
+
+
+ private static boolean isInited = false;
+
+ public static CustomerFactoryImpl init()
+ {
+ if (isInited) return (CustomerFactoryImpl)FactoryBase.getStaticFactory(CustomerFactoryImpl.NAMESPACE_URI);
+ CustomerFactoryImpl theCustomerFactoryImpl = new CustomerFactoryImpl();
+ isInited = true;
+
+ // Initialize simple dependencies
+ SDOUtil.registerStaticTypes(SDOFactory.class);
+ SDOUtil.registerStaticTypes(ModelFactory.class);
+ SDOUtil.registerStaticTypes(InternalFactory.class);
+
+ // Create package meta-data objects
+ theCustomerFactoryImpl.createMetaData();
+
+ // Initialize created meta-data
+ theCustomerFactoryImpl.initializeMetaData();
+
+ // Mark meta-data to indicate it can't be changed
+ //theCustomerFactoryImpl.freeze(); //FB do we need to freeze / should we freeze ????
+
+ return theCustomerFactoryImpl;
+ }
+
+ private boolean isCreated = false;
+
+ public void createMetaData()
+ {
+ if (isCreated) return;
+ isCreated = true;
+
+ // Create types and their properties
+ accountType = createType(false, ACCOUNT);
+ createProperty(true, accountType,AccountImpl.INTERNAL_ACCOUNT_NUM);
+ customerType = createType(false, CUSTOMER);
+ createProperty(false, customerType,CustomerImpl.INTERNAL_ACCOUNT);
+ createProperty(true, customerType,CustomerImpl.INTERNAL_FIRST_NAME);
+ }
+
+ private boolean isInitialized = false;
+
+ public void initializeMetaData()
+ {
+ if (isInitialized) return;
+ isInitialized = true;
+
+ // Obtain other dependent packages
+ ModelFactoryImpl theModelPackageImpl = (ModelFactoryImpl)FactoryBase.getStaticFactory(ModelFactoryImpl.NAMESPACE_URI);
+ Property property = null;
+
+ // Add supertypes to types
+
+ // Initialize types and properties
+ initializeType(accountType, Account.class, "Account", false);
+ property = getLocalProperty(accountType, 0);
+ initializeProperty(property, theModelPackageImpl.getInt(), "accountNum", "0", 0, 1, Account.class, false, true, false);
+
+ initializeType(customerType, Customer.class, "Customer", false);
+ property = getLocalProperty(customerType, 0);
+ initializeProperty(property, this.getAccount(), "account", null, 1, 1, Customer.class, false, true, false, true , null);
+
+ property = getLocalProperty(customerType, 1);
+ initializeProperty(property, theModelPackageImpl.getString(), "firstName", null, 0, 1, Customer.class, false, true, false);
+
+ createXSDMetaData(theModelPackageImpl);
+ }
+
+ protected void createXSDMetaData(ModelFactoryImpl theModelPackageImpl)
+ {
+ super.initXSD();
+
+ Property property = null;
+
+
+ addXSDMapping
+ (accountType,
+ new String[]
+ {
+ "name", "Account",
+ "kind", "empty"
+ });
+
+ addXSDMapping
+ (getProperty(accountType, AccountImpl.INTERNAL_ACCOUNT_NUM),
+ new String[]
+ {
+ "kind", "attribute",
+ "name", "accountNum",
+ "namespace", "##targetNamespace"
+ });
+
+ addXSDMapping
+ (customerType,
+ new String[]
+ {
+ "name", "Customer",
+ "kind", "elementOnly"
+ });
+
+ addXSDMapping
+ (getProperty(customerType, CustomerImpl.INTERNAL_ACCOUNT),
+ new String[]
+ {
+ "kind", "element",
+ "name", "account",
+ "namespace", "##targetNamespace"
+ });
+
+ addXSDMapping
+ (getProperty(customerType, CustomerImpl.INTERNAL_FIRST_NAME),
+ new String[]
+ {
+ "kind", "attribute",
+ "name", "firstName",
+ "namespace", "##targetNamespace"
+ });
+
+ property = createGlobalProperty
+ ("account",
+ this.getAccount(),
+ new String[]
+ {
+ "kind", "element",
+ "name", "account",
+ "namespace", "##targetNamespace"
+ });
+
+ property = createGlobalProperty
+ ("customer",
+ this.getCustomer(),
+ new String[]
+ {
+ "kind", "element",
+ "name", "customer",
+ "namespace", "##targetNamespace"
+ });
+
+ }
+
+} //CustomerFactoryImpl
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org