本文整理了Java中org.riotfamily.common.util.Generics
类的一些代码示例,展示了Generics
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Generics
类的具体详情如下:
包路径:org.riotfamily.common.util.Generics
类名称:Generics
暂无
代码示例来源:origin: riotfamily/riot
public void addClickListener(ClickListener listener) {
if (listeners == null) {
listeners = Generics.newArrayList();
}
listeners.add(listener);
}
代码示例来源:origin: riotfamily/riot
public void setDefaultMessage(Message defaultMessage) {
if (messages == null) {
messages = Generics.newHashMap();
}
messages.put(C_LOCALE, defaultMessage);
}
代码示例来源:origin: riotfamily/riot
public Interceptions(SessionFactory sessionFactory) {
this(sessionFactory, Generics.newHashSet());
}
代码示例来源:origin: riotfamily/riot
ParameterizedType pt = getInterfaceType(baseClass, childClass);
List<Class<?>> result = Generics.newArrayList();
if (pt != null) {
for (Type arg : pt.getActualTypeArguments()) {
result.add(Generics.getClass(arg));
Type type = childClass;
while (!getClass(type).equals(baseClass)) {
if (type instanceof Class<?>) {
type = ((Class<?>) type).getGenericSuperclass();
baseType = resolvedTypes.get(baseType);
typeArgumentsAsClasses.add(getClass(baseType));
代码示例来源:origin: riotfamily/riot
public SimpleFormRequest(Map<String, String> params) {
this.params = Generics.emptyIfNull(params);
}
代码示例来源:origin: riotfamily/riot
public List<ObjectError> getGlobalErrors() {
List<ObjectError> result = Generics.newLinkedList();
for (ObjectError error : errors) {
if (!(error instanceof FieldError)) {
result.add(error);
}
}
return Collections.unmodifiableList(result);
}
代码示例来源:origin: riotfamily/riot
@SuppressWarnings("unchecked")
private Class<T> getRequiredType() {
if (requiredType == null) {
requiredType = (Class<T>) Generics.getTypeArguments(
AbstractSingleItemCommand.class, getClass()).get(0);
}
return requiredType;
}
代码示例来源:origin: riotfamily/riot
public void setInterceptors(Set<Interceptor> interceptors) {
this.interceptors = Generics.emptyIfNull(interceptors);
}
代码示例来源:origin: riotfamily/riot
public List<FieldError> getFieldErrors() {
List<FieldError> result = Generics.newLinkedList();
for (ObjectError error : errors) {
if (error instanceof FieldError) {
result.add((FieldError) error);
}
}
return Collections.unmodifiableList(result);
}
代码示例来源:origin: riotfamily/riot
@SuppressWarnings("unchecked")
private Class<T> getRequiredType() {
if (requiredType == null) {
requiredType = (Class<T>) Generics.getTypeArguments(
AbstractBatchCommand.class, getClass()).get(0);
}
return requiredType;
}
代码示例来源:origin: riotfamily/riot
public void addChildLink(ScreenLink link) {
if (childLinks == null) {
childLinks = Generics.newArrayList();
}
childLinks.add(link);
}
代码示例来源:origin: riotfamily/riot
@SuppressWarnings("unchecked")
public static Map<String, String> getPathVariables(HttpServletRequest request) {
Map<String, String> vars = (Map<String, String>) request.getAttribute(
HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE);
if (vars == null) {
vars = Generics.newHashMap();
}
return vars;
}
代码示例来源:origin: riotfamily/riot
@SuppressWarnings("unchecked")
public InterceptorChain(HttpServletRequest request,
HttpServletResponse response) {
this.request = request;
this.response = response;
appliedInterceptors = (Set<RequestInterceptor>) request.getAttribute(APPLIED_INTERCEPTORS);
if (appliedInterceptors == null) {
appliedInterceptors = Generics.newHashSet();
request.setAttribute(APPLIED_INTERCEPTORS, appliedInterceptors);
}
}
代码示例来源:origin: riotfamily/riot
public List<Update> getUpdates() {
return Generics.emptyIfNull(updates);
}
代码示例来源:origin: riotfamily/riot
private <T> void register(T key, String url, Map<T, List<HandlerUrl>> map) {
List<HandlerUrl> urls = map.get(key);
if (urls == null) {
urls = Generics.newLinkedList();
map.put(key, urls);
}
urls.add(new HandlerUrl(url));
Collections.sort(urls);
}
代码示例来源:origin: riotfamily/riot
public TypedEntityListener() {
type = Generics.getTypeArguments(TypedEntityListener.class, getClass()).get(0);
}
代码示例来源:origin: riotfamily/riot
public final void setValue(Object value) {
selectedValues = Generics.newArrayList();
if (value != null) {
Collection<?> collection = (Collection<?>) value;
selectedValues.addAll(collection);
}
}
代码示例来源:origin: riotfamily/riot
private void setSection(String name) {
section = sections.get(name);
if (section == null) {
section = Generics.newHashMap();
sections.put(name, section);
}
}
代码示例来源:origin: riotfamily/riot
public void afterPropertiesSet() throws Exception {
if (ignoredAnnotations == null) {
ignoredAnnotations = Generics.newHashSet();
}
if (supportedAnnotations == null) {
supportedAnnotations = Generics.newHashSet();
}
if (ignoredTypes == null) {
ignoredTypes = Generics.newHashSet();
}
if (supportedTypes == null) {
supportedTypes = Generics.newHashSet();
}
ignoredAnnotations.add(PathVariable.class);
supportedAnnotations.addAll(Arrays.asList(
RequestParam.class, RequestHeader.class, CookieValue.class));
ignoredTypes.addAll(Arrays.asList(
Model.class, ModelMap.class, Map.class, Errors.class,
BindingResult.class, OutputStream.class, Writer.class,
HttpServletResponse.class));
supportedTypes.addAll(Arrays.asList(
Locale.class, Principal.class));
}
代码示例来源:origin: riotfamily/riot
public List<Object> getSavedEntities() {
return Generics.emptyIfNull(savedEntities);
}
内容来源于网络,如有侵权,请联系作者删除!