Пример #1
0
 public String getContent() {
   for (NewsContent newsContent : newsContents) {
     if (newsContent.getLang().getSymbol().equals(lang)) {
       return newsContent.getContent();
     }
   }
   return null;
 }
Пример #2
0
 private NewsContent getNewsContent() {
   for (NewsContent newsContent : newsContents) {
     if (newsContent.getLang().getSymbol().equals(lang)) {
       return newsContent;
     }
   }
   NewsContent newsContent = new NewsContent();
   newsContent.setLang(Lang.valueOf(lang));
   newsContent.setNews(this);
   newsContents.add(newsContent);
   return newsContent;
 }
Пример #3
0
 // setContent方法依赖于setLang方法先执行
 public void setContent(String content) {
   log.info("设置内容");
   log.info("模型语言:" + lang);
   NewsContent newsContent = getNewsContent();
   newsContent.setContent(content);
 }
Пример #4
0
 // setTitle方法依赖于setLang方法先执行
 public void setTitle(String title) {
   log.info("设置标题");
   log.info("模型语言:" + lang);
   NewsContent newsContent = getNewsContent();
   newsContent.setTitle(title);
 }