@SuppressWarnings("unchecked") @Test public void testGetSourceAccessor() { Request request = createMock(Request.class); @SuppressWarnings("unused") Map<String, Object> oneScope = createMock(Map.class); replay(request); assertEquals(".getContext(\"one\")", accessor.getSourceAccessor(null, request, "oneScope")); assertNull(accessor.getSourceAccessor(null, request, "whatever")); verify(request); }
@Override public String getSourceAccessor(OgnlContext context, Object target, Object index) { String scope = (String) index; if (scope.endsWith("Scope")) { String scopeName = scope.substring(0, scope.length() - SCOPE_SUFFIX_LENGTH); return ".getContext(\"" + scopeName + "\")"; } return null; }
ScopePropertyAccessor implements PropertyAccessor { @Override public String getSourceAccessor(OgnlContext context, Object target, Object index) { String scope = (String) index; if (scope.endsWith("Scope")) { String scopeName = scope.substring(0, scope.length() - SCOPE_SUFFIX_LENGTH); return ".getContext(\"" + scopeName + "\")"; } return null; } }
ScopePropertyAccessor implements PropertyAccessor { @Override public String getSourceAccessor(OgnlContext context, Object target, Object index) { String scope = (String) index; if (scope.endsWith("Scope")) { String scopeName = scope.substring(0, scope.length() - SCOPE_SUFFIX_LENGTH); return ".getContext(\"" + scopeName + "\")"; } return null; }  }
ScopePropertyAccessor implements PropertyAccessor { @Override public String getSourceAccessor(OgnlContext context, Object target, Object index) { String scope = (String) index; if (scope.endsWith("Scope")) { String scopeName = scope.substring(0, scope.length() - SCOPE_SUFFIX_LENGTH); return ".getContext(\"" + scopeName + "\")"; } return null; }  @Override Object getProperty(@SuppressWarnings("rawtypes") Map context, Object target, Object name); @Override String getSourceAccessor(OgnlContext context, Object target,
            Object index); @Override String getSourceSetter(OgnlContext context, Object target,
            Object index); @Override void setProperty(@SuppressWarnings("rawtypes") Map context, Object target, Object name,
            Object value); }
ScopePropertyAccessor implements PropertyAccessor { @Override public String getSourceAccessor(OgnlContext context, Object target, Object index) { String scope = (String) index; if (scope.endsWith("Scope")) { String scopeName = scope.substring(0, scope.length() - SCOPE_SUFFIX_LENGTH); return ".getContext(\"" + scopeName + "\")"; } return null; }  @Override Object getProperty(@SuppressWarnings("rawtypes") Map context, Object target, Object name); @Override String getSourceAccessor(OgnlContext context, Object target,
            Object index); @Override String getSourceSetter(OgnlContext context, Object target,
            Object index); @Override void setProperty(@SuppressWarnings("rawtypes") Map context, Object target, Object name,
            Object value);  }