/*
 * =============================================================================
 * 
 *   Copyright (c) 2011-2012, The THYMELEAF team (http://www.thymeleaf.org)
 * 
 *   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 License for the specific language governing permissions and
 *   limitations under the License.
 * 
 * =============================================================================
 */
package org.thymeleaf.context;

import java.util.HashMap;
import java.util.Map;

/**
 * <p>
 *   Special implementation of the {@link Map} interface that
 *   will be used for containing context variables in {@link IContext} 
 *   implementations.
 * </p>
 * <p>
 *   Constructors in this class mimic those in {@link HashMap} and
 *   have the same meaning.
 * </p>
 * 
 * @author Daniel Fern&aacute;ndez
 * 
 * @since 1.0
 *
 */
public class VariablesMap<K,V> extends HashMap<K,V> {

    private static final long serialVersionUID = 6785956724279950873L;
    
    

    public VariablesMap() {
        super();
    }

    public VariablesMap(final int initialCapacity, final float loadFactor) {
        super(initialCapacity, loadFactor);
    }

    public VariablesMap(final int initialCapacity) {
        super(initialCapacity);
    }

    public VariablesMap(final Map<? extends K, ? extends V> m) {
        super(m);
    }

    
    
    
}

@@ -906,16 +906,102 @@
 l.Map;%0A%0A
+import ognl.MapPropertyAccessor;%0Aimport ognl.OgnlException;%0Aimport ognl.OgnlRuntime;%0A%0A
 /**%0A * %3C
@@ -1844,21 +1844,1399 @@
  %7D%0A%0A    
-%0A    
+static %7B%0A    %09OgnlRuntime.setPropertyAccessor(VariablesMap.class, new VariablesMapPropertyAccessor());%0A    %7D%0A    %0A    /**%0A     * Extension of %7B@code MapPropertyAccessor%7D that handles getting of size property. When there is entry with %0A     * key %22size%22 it is returned instead of size property from %7B@code VariablesMap%7D. Otherwise this property %0A     * accessor works exactly same like %7B@code MapPropertyAccessor%7D.%0A     * %0A     * @author Michal Kreuzman%0A     * %0A     * @see MapPropertyAccessor%0A     * %0A     * @since 2.0%0A     */%0A    private static class VariablesMapPropertyAccessor extends MapPropertyAccessor %7B%0A    %09private static final String RESERVED_SIZE_PROPERTY_NAME = %22size%22;%0A    %09%0A    %09VariablesMapPropertyAccessor () %7B%0A    %09%7D%0A    %09%0A    %09@Override%0A    %09@SuppressWarnings(%22rawtypes%22) %0A%09%09public Object getProperty(Map context, Object target, Object name) throws OgnlException %7B%0A    %09%09if (!RESERVED_SIZE_PROPERTY_NAME.equals(name))%0A    %09%09%09return super.getProperty(context, target, name);%0A    %09%09%0A    %09%09Object result;%0A            Map map = (Map) target;%0A%0A            if (name instanceof String) %7B%0A               %09result = map.get(RESERVED_SIZE_PROPERTY_NAME);%0A               %09if (result == null)%0A                %09result = new Integer(map.size());%0A            %7D else %7B%0A            %09result = new Integer(map.size());%0A            %7D%0A            %0A            return result;%0A    %09%7D%0A    %7D
 %0A    %0A%7D%0A

Fix issue #94 - Superseding size property of VariablesMap if size variable is present in map.