In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article introduces the relevant knowledge of "what is the application of Java responsibility chain design pattern". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
1. Data flow diagram [part]
two。 Service architecture diagram [all]
3. On the Application of responsibility chain Design pattern in practice 3.1 part of Class Diagram
3.2 partial code screenshot @ Override public boolean filter (List handlerList) {List dynamicRecords = handlerList.stream () .filter (data-> dynamicData.test (data)) .map (data-> DynamicFormatUtil.toDataRecord (data)) .collect (Collectors.toList ()); List staticRecords = handlerList.stream () .filter (data-> staticData.test (data)) .map (data-> StaticFormatUtil.toDataRecord (data)) .map (Collectors.toList ()) Try {if (! CollectionUtils.isEmpty (dynamicRecords)) {filterDynamic (dynamicRecords);} if (! CollectionUtils.isEmpty (staticRecords)) {writeAfterFilterStatic (staticRecords);} return true;} catch (Exception e) {log.info ("filter data exception {}", e); return false;}} private void filterDynamic (List dynamicRecords) {dynamicFilterChain.doFilters (dynamicRecords) } @ Override public void doFilters (List record) {List filtereds = new ArrayList (); List filteredReasons = new ArrayList (); List afterFilters = new ArrayList (); List afterFilterRecords = new ArrayList (); record.forEach (dynamicRecord-> this .startFilter (dynamicRecord, filtereds, filteredReasons, afterFilterRecords)); if (! CollectionUtils.isEmpty (afterFilterRecords)) {/ / TODO saves filtered data saveDataHub (afterFilterRecords) } if (! CollectionUtils.isEmpty (filtereds)) {/ / TODO Save filter data} if (! CollectionUtils.isEmpty (filteredReasons)) {/ / TODO Save filter reason}} @ Service@Slf4jpublic class AccelerationFilter implements DynamicFilter {@ Override public FilterResult doFilter (DynamicRecord data, DynamicFilterChain filterChain, FilterResult filterResult, EnumFilter enumFilter) {return null The content of "what is the application of Java responsibility chain design pattern" is introduced here. Thank you for your reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.