本文整理了Java中org.riotfamily.common.util.Generics.newHashMap()
方法的一些代码示例,展示了Generics.newHashMap()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Generics.newHashMap()
方法的具体详情如下:
包路径:org.riotfamily.common.util.Generics
类名称:Generics
方法名:newHashMap
暂无
代码示例来源: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
public void setDefaultMessage(Message defaultMessage) {
if (messages == null) {
messages = Generics.newHashMap();
}
messages.put(C_LOCALE, defaultMessage);
}
代码示例来源: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
/**
* Returns a Map containing the bean's properties.
* @since 6.4
*/
public static Map<String, Object> getProperties(Object bean) {
PropertyDescriptor[] pd = BeanUtils.getPropertyDescriptors(bean.getClass());
HashMap<String, Object> properties = Generics.newHashMap();
for (int i = 0; i < pd.length; i++) {
Object value = ReflectionUtils.invokeMethod(pd[i].getReadMethod(), bean);
properties.put(pd[i].getName(), value);
}
return properties;
}
代码示例来源:origin: riotfamily/riot
/**
* Returns a Map containing the bean's properties.
* @since 6.4
*/
public static Map<String, Object> getProperties(Object bean, String[] propertyNames) {
HashMap<String, Object> properties = Generics.newHashMap();
for (int i = 0; i < propertyNames.length; i++) {
String name = propertyNames[i];
properties.put(name, getProperty(bean, name));
}
return properties;
}
代码示例来源:origin: riotfamily/riot
private Map<String, Object> buildModel() {
HashMap<String, Object> model = Generics.newHashMap();
if (iniFile != null) {
Map<String, Map<String,Object>> sections = iniFile.getSections();
model.putAll(sections);
model.putAll(sections.get(IniFile.GLOBAL_SECTION));
if (theme != null) {
Map<String, Object> current = sections.get(theme);
if (current != null) {
model.putAll(current);
}
}
}
return model;
}
代码示例来源:origin: riotfamily/riot
public FilterReader createFilterReader(Reader in, HttpServletRequest request) {
Map<String, String> props = Generics.newHashMap(properties);
if (exposeContextPath) {
props.put(CONTEXT_PATH_PROPERTY, request.getContextPath());
}
if (exposeLanguage) {
props.put(LANGUAGE_PROPERTY,
RequestContextUtils.getLocale(request).getLanguage().toLowerCase());
}
return new PropertyFilterReader(in, props);
}
代码示例来源:origin: riotfamily/riot
private static Map<String, String> extractTags(String comment) {
Map<String, String> tags = Generics.newHashMap();
if (comment != null) {
comment = LINE_START.matcher(comment).replaceAll("");
Matcher m = DOC_TAG.matcher(comment);
while (m.find()) {
String s = m.group(2);
if (s != null) {
s = s.replace('\n', ' ');
}
else {
s = "";
}
tags.put(m.group(1), s);
}
}
return tags;
}
代码示例来源:origin: riotfamily/riot
public void addTranslation(Locale locale, String text) {
Message msg = new Message();
msg.setText(text);
if (messages == null) {
messages = Generics.newHashMap();
}
messages.put(locale, msg);
}
代码示例来源:origin: riotfamily/riot
@Override
public final void render(Map<String, ?> model, HttpServletRequest request,
HttpServletResponse response) throws Exception {
if (allowModelOverride) {
Map<String, Object> emptyModel = Generics.newHashMap();
emptyModel.put(MODEL_ATTRIBUTE, model);
model = emptyModel;
}
super.render(model, request, wrapResponse(request, response));
}
代码示例来源:origin: riotfamily/riot
protected ModelAndView handleRequest(ScreenContext context) {
Map<String, Object> model = Generics.newHashMap();
populateModel(model, context);
ModelAndView mv = new ModelAndView(getViewName(), model);
return mv;
}
代码示例来源:origin: riotfamily/riot
public void digest(Document doc, Resource resource) {
this.resource = resource;
formId = null;
imports = new ArrayList<Import>();
currentPackage = null;
Element root = doc.getDocumentElement();
for (Element ele : XmlUtils.getChildElements(root)) {
String namespace = ele.getNamespaceURI();
if (namespace == null || namespace.equals(NAMESPACE)) {
if (DomUtils.nodeNameEquals(ele, "form")) {
parseFormDefinition(ele);
}
else if (DomUtils.nodeNameEquals(ele, "package")) {
parsePackageDefinition(ele);
}
}
}
Map<ContainerElementFactory, Integer> appliedForms = Generics.newHashMap();
for (Import imp : imports) {
int offset = appliedForms.containsKey(imp.parent) ? appliedForms.get(imp.parent) : 0;
imp.insertAt += offset;
offset += imp.apply();
appliedForms.put(imp.parent, offset);
}
}
代码示例来源:origin: riotfamily/riot
@Override
protected Map<String, Command> getCommands() {
if (commands == null) {
if (chooserTarget != null) {
commands = Generics.newHashMap();
if (chooserTarget != screen) {
nextList = chooserTarget;
ListScreen parent = ScreenUtils.getParentListScreen(nextList);
while (parent != screen && parent != null) {
nextList = parent;
parent = ScreenUtils.getParentListScreen(nextList);
}
commands.put("descend", new DescendCommand());
}
else {
if (dao.getEntityClass().isAssignableFrom(
chooserTarget.getDao().getEntityClass())) {
commands.put("choose", new ChooseCommand());
}
}
}
else {
commands = screen.getCommandMap();
}
}
return commands;
}
代码示例来源:origin: riotfamily/riot
public RiotFile(RiotFile riotFile, boolean copyVariants) throws IOException {
this.fileName = riotFile.getFileName();
this.uri = mediaService.store(new FileInputStream(riotFile.getFile()), fileName, riotFile.getBucket());
this.contentType = riotFile.getContentType();
this.size = riotFile.getSize();
this.md5 = riotFile.getMd5();
this.owner = riotFile.getOwner();
this.creationDate = riotFile.getCreationDate();
if (copyVariants) {
Map<String, RiotFile> otherVariants = riotFile.getVariants();
if (otherVariants != null) {
this.variants = Generics.newHashMap();
for (Entry<String, RiotFile> entry : otherVariants.entrySet()) {
RiotFile variant = entry.getValue();
if (variant != null) {
addVariant(entry.getKey(), variant.copy(true));
}
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!