Example #1
0
 public void addKeyLookup(KeyType keyType, ReferenceType valueType) {
   String mapName = Tools.toJavaName(keyType.getKeyName(), true);
   GenericType mapType = TypeFactory.newGenericType(pack, "java.util.Map", "Map");
   mapType.addTypeArgument(
       TypeFactory.newTypeArgument(TypeFactory.newReferenceType(pack, keyType.getJavaName(), "")));
   mapType.addTypeArgument(TypeFactory.newTypeArgument(valueType));
   Field mapField = SourceFactory.newField("map" + mapName + "Keys", mapType);
   mapField.setDefaultExpression(
       "new java.util.HashMap<" + keyType.getJavaName() + "," + valueType.getJavaName() + ">()");
   addField(mapField);
 }
Example #2
0
 public DocumentClass(XMLPackage pack) {
   super(pack, null, "XMLDocument");
   this.pack = pack;
   addSuperInterface(
       TypeFactory.newReferenceType(
           pack, "de.realityinabox.databinding.libs.Document", "Document"));
   addField(
       SourceFactory.newField(
           "_root",
           TypeFactory.newReferenceType(
               pack, "de.realityinabox.databinding.libs.XMLElement", "XMLElement")));
   addField(
       SourceFactory.newField(
           "_parseStack",
           TypeFactory.newReferenceType(
               pack, "de.realityinabox.databinding.libs.ParseStack", "ParseStack")));
   addConstructor();
   addGetParseStackMethod();
   addGetElementFactoryMethod();
   addGetRootMethod();
   addSetRootMethod();
   addNestedClass(new ContentInterceptorClass());
 }