Resolves beans in request, session and application scope.
Method from org.apache.tiles.el.TilesContextBeanELResolver Detail: |
protected void collectBeanInfo(Map<String, Object> map,
List<FeatureDescriptor> list) {
if (map == null || map.isEmpty()) {
return;
}
for (Map.Entry< String, ? extends Object > entry : map.entrySet()) {
FeatureDescriptor descriptor = new FeatureDescriptor();
descriptor.setDisplayName(entry.getKey());
descriptor.setExpert(false);
descriptor.setHidden(false);
descriptor.setName(entry.getKey());
descriptor.setPreferred(true);
descriptor.setShortDescription("");
descriptor.setValue("type", String.class);
descriptor.setValue("resolvableAtDesignTime", Boolean.FALSE);
list.add(descriptor);
}
}
Collects bean infos from a map's values and filling a list. |
protected Object findObjectByProperty(ELContext context,
Object property) {
Object retValue = null;
TilesRequestContext request = (TilesRequestContext) context
.getContext(TilesRequestContext.class);
String prop = property.toString();
retValue = getObject(request.getRequestScope(), prop);
if (retValue == null) {
retValue = getObject(request.getSessionScope(), prop);
if (retValue == null) {
TilesApplicationContext applicationContext = (TilesApplicationContext) context
.getContext(TilesApplicationContext.class);
retValue = getObject(applicationContext.getApplicationScope(),
prop);
}
}
return retValue;
}
Finds an object in request, session or application scope, in this order. |
public Class<?> getCommonPropertyType(ELContext context,
Object base) {
// only resolve at the root of the context
if (base != null) {
return null;
}
return String.class;
}
|
public Iterator<FeatureDescriptor> getFeatureDescriptors(ELContext context,
Object base) {
List< FeatureDescriptor > list = new ArrayList< FeatureDescriptor >();
TilesRequestContext request = (TilesRequestContext) context
.getContext(TilesRequestContext.class);
collectBeanInfo(request.getRequestScope(), list);
collectBeanInfo(request.getSessionScope(), list);
TilesApplicationContext applicationContext = (TilesApplicationContext) context
.getContext(TilesApplicationContext.class);
collectBeanInfo(applicationContext.getApplicationScope(), list);
return list.iterator();
}
|
protected Object getObject(Map<String, Object> map,
String property) {
Object retValue = null;
if (map != null) {
retValue = map.get(property);
}
return retValue;
}
Returns an object from a map in a null-safe manner. |
public Class<?> getType(ELContext context,
Object base,
Object property) {
if (base != null) {
return null;
}
Object obj = findObjectByProperty(context, property);
if (obj != null) {
context.setPropertyResolved(true);
return obj.getClass();
}
return null;
}
|
public Object getValue(ELContext context,
Object base,
Object property) {
if (base != null) {
return null;
}
Object retValue = findObjectByProperty(context, property);
if (retValue != null) {
context.setPropertyResolved(true);
}
return retValue;
}
|
public boolean isReadOnly(ELContext context,
Object base,
Object property) {
if (context == null) {
throw new NullPointerException();
}
return true;
}
|
public void setValue(ELContext context,
Object base,
Object property,
Object value) {
// Does nothing for the moment.
}
|