@@ -89,6 +89,7 @@ public TemplateRegistry(TemplateRegistry registry) {
8989 chain = createTemplateBuilderChain ();
9090 cache = new HashMap <Type , Template <Type >>();
9191 genericCache = parent .genericCache ;
92+ registerTemplatesWhichRefersRegistry ();
9293 }
9394
9495 protected TemplateBuilderChain createTemplateBuilderChain (){
@@ -101,6 +102,7 @@ public void setClassLoader(final ClassLoader cl) {
101102 }
102103
103104 private void registerTemplates () {
105+
104106 register (boolean .class , BooleanTemplate .getInstance ());
105107 register (Boolean .class , BooleanTemplate .getInstance ());
106108 register (byte .class , ByteTemplate .getInstance ());
@@ -128,10 +130,23 @@ private void registerTemplates() {
128130 register (byte [].class , ByteArrayTemplate .getInstance ());
129131 register (ByteBuffer .class , ByteBufferTemplate .getInstance ());
130132 register (Value .class , ValueTemplate .getInstance ());
131- //register(Value.class, AnyTemplate.getInstance(this));
132- register (List .class , new ListTemplate (AnyTemplate .getInstance (this )));
133- register (Collection .class , new CollectionTemplate (AnyTemplate .getInstance (this )));
134- register (Map .class , new MapTemplate (AnyTemplate .getInstance (this ), AnyTemplate .getInstance (this )));
133+ registerTemplatesWhichRefersRegistry ();
134+ /*register(List.class, new ListTemplate(AnyTemplate.getInstance(this)));
135+ register(Collection.class,new CollectionTemplate(AnyTemplate.getInstance(this)));
136+ register(Map.class,new MapTemplate(AnyTemplate.getInstance(this), AnyTemplate.getInstance(this)));
137+
138+ registerGeneric(List.class, new GenericCollectionTemplate(this, ListTemplate.class));
139+ registerGeneric(Collection.class, new GenericCollectionTemplate(this, CollectionTemplate.class));
140+ registerGeneric(Map.class, new GenericMapTemplate(this, MapTemplate.class));*/
141+ }
142+
143+
144+ protected void registerTemplatesWhichRefersRegistry () {
145+ AnyTemplate anyTemplate = new AnyTemplate (this );
146+
147+ register (List .class , new ListTemplate (anyTemplate ));//new ListTemplate(AnyTemplate.getInstance(this)));
148+ register (Collection .class ,new CollectionTemplate (anyTemplate ));//new CollectionTemplate(AnyTemplate.getInstance(this)));
149+ register (Map .class ,new MapTemplate (anyTemplate ,anyTemplate ));//new MapTemplate(AnyTemplate.getInstance(this), AnyTemplate.getInstance(this)));
135150
136151 registerGeneric (List .class , new GenericCollectionTemplate (this , ListTemplate .class ));
137152 registerGeneric (Collection .class , new GenericCollectionTemplate (this , CollectionTemplate .class ));
0 commit comments