Polishing
This commit is contained in:
parent
7fa3e65d04
commit
acefd8381d
|
@ -45,7 +45,7 @@ public class TypeDescriptor implements Serializable {
|
||||||
|
|
||||||
static final Annotation[] EMPTY_ANNOTATION_ARRAY = new Annotation[0];
|
static final Annotation[] EMPTY_ANNOTATION_ARRAY = new Annotation[0];
|
||||||
|
|
||||||
private static final Map<Class<?>, TypeDescriptor> commonTypesCache = new HashMap<Class<?>, TypeDescriptor>();
|
private static final Map<Class<?>, TypeDescriptor> commonTypesCache = new HashMap<Class<?>, TypeDescriptor>(18);
|
||||||
|
|
||||||
private static final Class<?>[] CACHED_COMMON_TYPES = {
|
private static final Class<?>[] CACHED_COMMON_TYPES = {
|
||||||
boolean.class, Boolean.class, byte.class, Byte.class, char.class, Character.class,
|
boolean.class, Boolean.class, byte.class, Byte.class, char.class, Character.class,
|
||||||
|
|
|
@ -30,6 +30,7 @@ import org.apache.tiles.request.servlet.ServletApplicationContext;
|
||||||
|
|
||||||
import org.springframework.core.io.Resource;
|
import org.springframework.core.io.Resource;
|
||||||
import org.springframework.core.io.support.ResourcePatternResolver;
|
import org.springframework.core.io.support.ResourcePatternResolver;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
import org.springframework.web.context.support.ServletContextResourcePatternResolver;
|
import org.springframework.web.context.support.ServletContextResourcePatternResolver;
|
||||||
|
|
||||||
|
@ -53,22 +54,20 @@ public class SpringWildcardServletTilesApplicationContext extends ServletApplica
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApplicationResource getResource(String localePath) {
|
public ApplicationResource getResource(String localePath) {
|
||||||
ApplicationResource retValue = null;
|
|
||||||
Collection<ApplicationResource> urlSet = getResources(localePath);
|
Collection<ApplicationResource> urlSet = getResources(localePath);
|
||||||
if (urlSet != null && !urlSet.isEmpty()) {
|
if (!CollectionUtils.isEmpty(urlSet)) {
|
||||||
retValue = urlSet.iterator().next();
|
return urlSet.iterator().next();
|
||||||
}
|
}
|
||||||
return retValue;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ApplicationResource getResource(ApplicationResource base, Locale locale) {
|
public ApplicationResource getResource(ApplicationResource base, Locale locale) {
|
||||||
ApplicationResource retValue = null;
|
|
||||||
Collection<ApplicationResource> urlSet = getResources(base.getLocalePath(locale));
|
Collection<ApplicationResource> urlSet = getResources(base.getLocalePath(locale));
|
||||||
if (urlSet != null && !urlSet.isEmpty()) {
|
if (!CollectionUtils.isEmpty(urlSet)) {
|
||||||
retValue = urlSet.iterator().next();
|
return urlSet.iterator().next();
|
||||||
}
|
}
|
||||||
return retValue;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -26,6 +26,7 @@ import org.apache.tiles.servlet.context.ServletTilesApplicationContext;
|
||||||
|
|
||||||
import org.springframework.core.io.Resource;
|
import org.springframework.core.io.Resource;
|
||||||
import org.springframework.core.io.support.ResourcePatternResolver;
|
import org.springframework.core.io.support.ResourcePatternResolver;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.util.ObjectUtils;
|
import org.springframework.util.ObjectUtils;
|
||||||
import org.springframework.web.context.support.ServletContextResourcePatternResolver;
|
import org.springframework.web.context.support.ServletContextResourcePatternResolver;
|
||||||
|
|
||||||
|
@ -48,12 +49,11 @@ public class SpringWildcardServletTilesApplicationContext extends ServletTilesAp
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public URL getResource(String path) throws IOException {
|
public URL getResource(String path) throws IOException {
|
||||||
URL retValue = null;
|
|
||||||
Set<URL> urlSet = getResources(path);
|
Set<URL> urlSet = getResources(path);
|
||||||
if (urlSet != null && !urlSet.isEmpty()) {
|
if (!CollectionUtils.isEmpty(urlSet)) {
|
||||||
retValue = urlSet.iterator().next();
|
return urlSet.iterator().next();
|
||||||
}
|
}
|
||||||
return retValue;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue