﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>BlogJava-lyyb2001-随笔分类-J2SE技术</title><link>http://blogjava.net/lyyb2001/category/21521.html</link><description>只是为方便自己找记录而已</description><language>zh-cn</language><lastBuildDate>Thu, 06 Jul 2017 07:56:02 GMT</lastBuildDate><pubDate>Thu, 06 Jul 2017 07:56:02 GMT</pubDate><ttl>60</ttl><item><title>java 8 stream根据对象进行比较，或者最大的那条记录的值 </title><link>http://www.blogjava.net/lyyb2001/archive/2017/07/06/432648.html</link><dc:creator>skycity</dc:creator><author>skycity</author><pubDate>Thu, 06 Jul 2017 07:43:00 GMT</pubDate><guid>http://www.blogjava.net/lyyb2001/archive/2017/07/06/432648.html</guid><wfw:comment>http://www.blogjava.net/lyyb2001/comments/432648.html</wfw:comment><comments>http://www.blogjava.net/lyyb2001/archive/2017/07/06/432648.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lyyb2001/comments/commentRss/432648.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lyyb2001/services/trackbacks/432648.html</trackback:ping><description><![CDATA[<span style="white-space:pre">	</span>Optional&lt;MaterialPaneModel&gt; maxMaterial = list.stream().max(Comparator.comparingInt(MaterialPaneModel::getMaterialQty));<img src ="http://www.blogjava.net/lyyb2001/aggbug/432648.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lyyb2001/" target="_blank">skycity</a> 2017-07-06 15:43 <a href="http://www.blogjava.net/lyyb2001/archive/2017/07/06/432648.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>Caused by: org.apache.cxf.BusException: No binding factory for namespace http://schemas.xmlsoap.org/soap/ registered.</title><link>http://www.blogjava.net/lyyb2001/archive/2016/03/04/429535.html</link><dc:creator>skycity</dc:creator><author>skycity</author><pubDate>Fri, 04 Mar 2016 07:02:00 GMT</pubDate><guid>http://www.blogjava.net/lyyb2001/archive/2016/03/04/429535.html</guid><wfw:comment>http://www.blogjava.net/lyyb2001/comments/429535.html</wfw:comment><comments>http://www.blogjava.net/lyyb2001/archive/2016/03/04/429535.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lyyb2001/comments/commentRss/429535.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lyyb2001/services/trackbacks/429535.html</trackback:ping><description><![CDATA[<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">cxf webservice客户端程序在eclipse里面运行的好好的，但是一旦用mvn&nbsp;assembly:assembly将依赖和主代码打成一个可运行的jar时，调用就会出现如下错误：</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><br />
</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">Exception in thread "main" org.apache.cxf.service.factory.ServiceConstructionException: Could not resolve a binding for null</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="Apple-tab-span" style="white-space:pre">	</span>at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createBindingInfo(AbstractWSDLBasedEndpointFactory.java:352)</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="Apple-tab-span" style="white-space:pre">	</span>at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpointInfo(AbstractWSDLBasedEndpointFactory.java:259)</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="Apple-tab-span" style="white-space:pre">	</span>at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createEndpoint(AbstractWSDLBasedEndpointFactory.java:144)</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="Apple-tab-span" style="white-space:pre">	</span>at org.apache.cxf.frontend.ClientFactoryBean.create(ClientFactoryBean.java:91)</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="Apple-tab-span" style="white-space:pre">	</span>at org.apache.cxf.frontend.ClientProxyFactoryBean.create(ClientProxyFactoryBean.java:157)</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="Apple-tab-span" style="white-space:pre">	</span>at org.apache.cxf.jaxws.JaxWsProxyFactoryBean.create(JaxWsProxyFactoryBean.java:142)</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="Apple-tab-span" style="white-space:pre">	</span>at com.nabf.start.NABFClient.main(NABFClient.java:30)</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">Caused by: org.apache.cxf.BusException: No binding factory for namespace http://schemas.xmlsoap.org/soap/ registered.</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="Apple-tab-span" style="white-space:pre">	</span>at org.apache.cxf.bus.managers.BindingFactoryManagerImpl.getBindingFactory(BindingFactoryManagerImpl.java:93)</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="Apple-tab-span" style="white-space:pre">	</span>at org.apache.cxf.frontend.AbstractWSDLBasedEndpointFactory.createBindingInfo(AbstractWSDLBasedEndpointFactory.java:339)</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="Apple-tab-span" style="white-space:pre">	</span>... 6 more</p>
<div>而用mV clean package dependency:copy-dependencies -DoutputDirectory=target/lib启动的时候加载lib包下所有的文件也不会出现错误</div>
<div><br />
</div>
<div>解决办法：在pom.xml的build中添加如下，然后执行mV clean package，打出来的包就含有依赖包，且问题解决。原因？</div>
<div>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: #4f76cb;"><span style="font-family: verdana, 'courier new'; font-size: 14px;">&nbsp; &nbsp;&nbsp;</span><span style="font-family: verdana, 'courier new'; font-size: 14px;">&nbsp; &nbsp;&nbsp;</span><span style="font-family: verdana, 'courier new'; font-size: 14px;">&nbsp; &nbsp;&nbsp;</span><span style="font-family: verdana, 'courier new'; font-size: 14px;">&nbsp; &nbsp;&nbsp;</span><span style="font-family: verdana, 'courier new'; font-size: 14px;">&nbsp; &nbsp;&nbsp;</span><span style="font-family: verdana, 'courier new'; font-size: 14px;">&nbsp; &nbsp;&nbsp;</span><span style="font-family: verdana, 'courier new'; font-size: 14px;">&nbsp; &nbsp;&nbsp;</span><span style="text-decoration: underline;">&lt;plugin&gt;</span></p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: #4f76cb;"><span class="Apple-tab-span" style="white-space:pre">				</span>&lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: #4f76cb;"><span class="Apple-tab-span" style="white-space:pre">				</span>&lt;artifactId&gt;<span style="text-decoration: underline">maven</span>-shade-<span style="text-decoration: underline">plugin</span>&lt;/artifactId&gt;</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: #4f76cb;"><span class="Apple-tab-span" style="white-space:pre">				</span>&lt;version&gt;1.6&lt;/version&gt;</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: #4f76cb;"><span class="Apple-tab-span" style="white-space:pre">				</span>&lt;configuration&gt;</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: #4f76cb;"><span class="Apple-tab-span" style="white-space:pre">					</span>&lt;archive&gt;</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: #4f76cb;"><span class="Apple-tab-span" style="white-space:pre">						</span>&lt;manifest&gt;</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: #4f76cb;"><span class="Apple-tab-span" style="white-space:pre">							</span>&lt;addClasspath&gt;true&lt;/addClasspath&gt;</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: #4f76cb;"><span class="Apple-tab-span" style="white-space:pre">							</span>&lt;mainClass&gt;com.nabf.start.NABFClient&lt;/mainClass&gt;</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: #4f76cb;"><span class="Apple-tab-span" style="white-space:pre">						</span>&lt;/manifest&gt;</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: #4f76cb;"><span class="Apple-tab-span" style="white-space:pre">					</span>&lt;/archive&gt;</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: #4f76cb;"><span class="Apple-tab-span" style="white-space:pre">				</span>&lt;/configuration&gt;</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: #4f76cb;"><span class="Apple-tab-span" style="white-space:pre">				</span>&lt;executions&gt;</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: #4f76cb;"><span class="Apple-tab-span" style="white-space:pre">					</span>&lt;execution&gt;</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: #4f76cb;"><span class="Apple-tab-span" style="white-space:pre">						</span>&lt;phase&gt;package&lt;/phase&gt;</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: #4f76cb;"><span class="Apple-tab-span" style="white-space:pre">						</span>&lt;goals&gt;</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: #4f76cb;"><span class="Apple-tab-span" style="white-space:pre">							</span>&lt;goal&gt;shade&lt;/goal&gt;</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: #4f76cb;"><span class="Apple-tab-span" style="white-space:pre">						</span>&lt;/goals&gt;</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: #4f76cb;"><span class="Apple-tab-span" style="white-space:pre">						</span>&lt;configuration&gt;</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: #4f76cb;"><span class="Apple-tab-span" style="white-space:pre">							</span>&lt;transformers&gt;</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: #4f76cb;"><span class="Apple-tab-span" style="white-space:pre">								</span>&lt;transformer</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: #4f76cb;"><span class="Apple-tab-span" style="white-space:pre">									</span>implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer"&gt;</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: #4f76cb;"><span class="Apple-tab-span" style="white-space:pre">									</span>&lt;resource&gt;META-INF/<span style="text-decoration: underline">cxf</span>/bus-extensions.txt&lt;/resource&gt;</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: #4f76cb;"><span class="Apple-tab-span" style="white-space:pre">								</span>&lt;/transformer&gt;</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: #4f76cb;"><span class="Apple-tab-span" style="white-space:pre">							</span>&lt;/transformers&gt;</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: #4f76cb;"><span class="Apple-tab-span" style="white-space:pre">						</span>&lt;/configuration&gt;</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: #4f76cb;"><span class="Apple-tab-span" style="white-space:pre">					</span>&lt;/execution&gt;</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: #4f76cb;"><span class="Apple-tab-span" style="white-space:pre">				</span>&lt;/executions&gt;</p>
<p style="margin: 0px; font-size: 11px; line-height: normal; font-family: Monaco; color: #4f76cb;"><span class="Apple-tab-span" style="white-space:pre">			</span><span style="text-decoration: underline">&lt;/plugin&gt;</span>&nbsp;</p>
</div>
<div><br />
</div>
<div><br />
</div>
<div><br />
</div>
@import url(http://www.blogjava.net/CuteSoft_Client/CuteEditor/Load.ashx?type=style&file=SyntaxHighlighter.css);@import url(/css/cuteeditor.css);<img src ="http://www.blogjava.net/lyyb2001/aggbug/429535.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lyyb2001/" target="_blank">skycity</a> 2016-03-04 15:02 <a href="http://www.blogjava.net/lyyb2001/archive/2016/03/04/429535.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>正则表达式匹配字符串</title><link>http://www.blogjava.net/lyyb2001/archive/2015/03/20/423659.html</link><dc:creator>skycity</dc:creator><author>skycity</author><pubDate>Fri, 20 Mar 2015 01:41:00 GMT</pubDate><guid>http://www.blogjava.net/lyyb2001/archive/2015/03/20/423659.html</guid><wfw:comment>http://www.blogjava.net/lyyb2001/comments/423659.html</wfw:comment><comments>http://www.blogjava.net/lyyb2001/archive/2015/03/20/423659.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lyyb2001/comments/commentRss/423659.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lyyb2001/services/trackbacks/423659.html</trackback:ping><description><![CDATA[<div>有这样一个串</div>
<div>Read([SQLServer#10.5.219.21#mas_db],[select * from material where machine_seq='!dbo.repair.machine_seq' and b='@@dbo.test.cc' and c='!!dbo.test.dd' and d='@dbo.repair' and e='sd.bf' and f='@aa.bg' and g='#dbo.repair.machine_name' and h=@dbo.repair.owner],[en_US])</div>
<div>需要解析中间的select * from material where machine_seq='!dbo.repair.machine_seq' and b='@@dbo.test.cc' and c='!!dbo.test.dd' and d='@dbo.repair' and e='sd.bf' and f='@aa.bg' and g='#dbo.repair.machine_name' and h=@dbo.repair.owner</div>
<div>还需要满足'@@','@','!'（前后包含单引号）,的变量取出来</div>
<div>@schema.table.fieldName &nbsp; &nbsp; @dbo.repair.machine_seq要点：获取界面上某个控件录入的值;</div>
<div>#schema.table &nbsp; &nbsp; #dbo.reapir要点：获取这个表的记录行数；</div>
<div>!schema.table.fieldName &nbsp; !dbo.repair.qty要点：统计dbo.repair表qty总和. 相当于Sum(qty)性质.</div>
<div>@@constName &nbsp; @@User_ID要点：获取内存变量值；</div>
<div><br />
</div>
<div>实现如下：</div>
<div>package com.lenovo.nabf.util;</div>
<div><br />
</div>
<div>import java.util.ArrayList;</div>
<div>import java.util.List;</div>
<div>import java.util.regex.Matcher;</div>
<div>import java.util.regex.Pattern;</div>
<div><br />
</div>
<div>public class NabfUtilTest {</div>
<div>&nbsp; &nbsp; public static final Pattern PatternSql = Pattern.compile("\\'(([#!]{1}|[@]{1,2})[\\w\\.]+?)\\'"); // match '@dbo.repair.machine_seq'</div>
<div>&nbsp; &nbsp; public static final Pattern PatternReadString = Pattern.compile(".+?,\\[([\\w\\.\\s{*!@#=\'}]+?)\\],.+?"); &nbsp;//match Read([db],[sqlstring],[lang])得到sqlstring的值</div>
<div>&nbsp; &nbsp; public static void main(String args[]){</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;String readString="Read([SQLServer#10.5.219.21#mas_db],[select * from material where "</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + "machine_seq='!dbo.repair.machine_seq' and b='@@dbo.test.cc' "</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + "and c='!!dbo.test.dd' and d='@dbo.repair' and e='sd.bf' and f='@aa.bg' "</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + "and g='#dbo.repair.machine_name' and h=@dbo.repair.owner],[en_US])";&nbsp;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(readString);</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(analysisReadStr(readString));</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; List list=NabfUtil.getRegexMatchedList(readString);</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; for(String s:list){</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;System.out.println(s);</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; }</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; String sqlString = NabfUtil.getStringByAnalysisReadString(readString);</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; System.out.println(sqlString);</div>
<div>&nbsp; &nbsp; }&nbsp;</div>
<div>&nbsp; &nbsp; public static ArrayList getRegexMatchedList(String readString){</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; String sqlString = analysisReadStr(readString);</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; ArrayList matchList=new ArrayList();</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; Matcher matcher = PatternSql.matcher(sqlString);</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; int lastEndIndex = 0;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; while (matcher.find(lastEndIndex)) {</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; matchList.add(matcher.group(1));</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lastEndIndex = matcher.end();</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; }</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; return matchList;</div>
<div>&nbsp; &nbsp; }</div>
<div>&nbsp; &nbsp; public static String getStringByAnalysisReadString(String readString){</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; String sqlString = analysisReadStr(readString);</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; Matcher matcher = PatternSql.matcher(sqlString);</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; StringBuilder sb = new StringBuilder();</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; int lastEndIndex = 0;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; while (matcher.find(lastEndIndex)) {</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; sb.append(sqlString.substring(lastEndIndex, matcher.start()));</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; lastEndIndex = matcher.end();</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; }</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; sb.append(sqlString.substring(lastEndIndex));</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; return sb.toString();</div>
<div>&nbsp; &nbsp; }</div>
<div>&nbsp; &nbsp; private static String analysisReadStr(String readString){</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; Matcher matcher = PatternReadString.matcher(readString);</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; int lastEndIndex = 0;</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; String sqlString="";</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; while (matcher.find(lastEndIndex)) {</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;sqlString=matcher.group(1);</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;lastEndIndex = matcher.end();</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; }</div>
<div>&nbsp; &nbsp; &nbsp; &nbsp; return sqlString;</div>
<div>&nbsp; &nbsp;}</div>
<div>}</div>
<div><br />
</div><img src ="http://www.blogjava.net/lyyb2001/aggbug/423659.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lyyb2001/" target="_blank">skycity</a> 2015-03-20 09:41 <a href="http://www.blogjava.net/lyyb2001/archive/2015/03/20/423659.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JDepend学习</title><link>http://www.blogjava.net/lyyb2001/archive/2015/03/20/423658.html</link><dc:creator>skycity</dc:creator><author>skycity</author><pubDate>Fri, 20 Mar 2015 01:40:00 GMT</pubDate><guid>http://www.blogjava.net/lyyb2001/archive/2015/03/20/423658.html</guid><wfw:comment>http://www.blogjava.net/lyyb2001/comments/423658.html</wfw:comment><comments>http://www.blogjava.net/lyyb2001/archive/2015/03/20/423658.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lyyb2001/comments/commentRss/423658.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lyyb2001/services/trackbacks/423658.html</trackback:ping><description><![CDATA[JDepend 一个开放源代码的可以用来评价Java程序质量的优秀工具，它遍历Java class的文件目录，以Java包（package）为单位，为每一个包/类自动生成 包的依赖程度，稳定性，可靠度等的评价报告，根据这些报告，我们可以得到包或类之间的依赖关系，并分析出包的稳定程度，抽象程度，是否存在循环依赖关系 等。
<div>我们可以根据JDepend给出的报告数据，分析出我们的包是否是可靠的，稳定的，健壮的包，是否符合面向对象的设计原则。
<div>
<div>JDepend 一个开放源代码的可以用来评价Java程序质量的优秀工具，它遍历Java class的文件目录，以Java包（package）为单位，为每一个包/类自动生成 包的依赖程度，稳定性，可靠度等的评价报告，根据这些报告，我们可以得到包或类之间的依赖关系，并分析出包的稳定程度，抽象程度，是否存在循环依赖关系 等。</div>
<div>我们可以根据JDepend给出的报告数据，分析出我们的包是否是可靠的，稳定的，健壮的包，是否符合面向对象的设计原则。</div>
<div>一个具有稳定性，扩展性，可维护性的软件系统要求系统设计遵循面向对象的设计原则。一般来说，面向对象的设计原则要求满足高聚合，低耦合，禁止循环依赖等基本原则。</div>
<div>JDepend生成的Java包的质量评价报告主要包括：</div>
<div>Number of Classes and Interfaces(TC)：实现类与抽象接口的数目</div>
<div>CC:包内具体的实现类的数目</div>
<div>AC:包内抽象类和接口类的数目</div>
<div>Abstractness (A)：包的抽象度。指一个包内包含的抽象类或接口占整个包中的类的比重。即A=AC/TC,该值处于0，1之间，若A=0，说明包内不包含任何抽象类或接口；若A=1,说明包内全部是抽象类或接口。</div>
<div>Efferent Couplings (Ce)：离心耦合。被该包依赖的外部包的数目（i.e. outgoing dependencies），该数值越大，说明该包越不独立（因为依赖了别的包），也越不稳定。</div>
<div>Afferent Couplings (Ca)：向心耦合。依赖该包（包含的类）的外部包（类）的数目（i.e. incoming dependencies），该数值越大，说明该包的担当的职责越大，也就越稳定。</div>
<div>Instability (I)：衡量一个包的不稳定程度。I=Ce/(Ce+Ca)。它的值处于[0，1]之间。I=0时，没有依赖外部包，此时包是最稳定的，反之I=1，没有外部依赖&#8220;我&#8221;，则说明包极不稳定。</div>
<div>Distance from the Main Sequence (D)： 该指标主要用来评价包的抽象程度与稳定程度的平衡关系，它可以用二维直线图 A + I = 1 来表示。D=abs((A + I) - 1)，也就是说D为 一个包的抽象度 + 包的不稳定程度 - 1 的绝对值。一个理想的包是：完全抽象的（A=1,I=0），非常稳定的(I=0)，这时D=0；或者是：完全具体类构成的包（A=0,I=1），非常不稳定的 (I=1)，这时同样也有D=0。D=0说明包的抽象程度与稳定程度是平衡的，反之D=1说明包的平衡程度被严重破坏。D值越大，越需要受到关注。 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div>
<div>面向的设计原则之一The Stable Abstractions Principle (SAP)：稳定抽象等价原则指出了包的稳定程度与它的抽象程度（接口的数目）成正比，也就是说，一个包内包含的接口所占的比重越大，这个包就越稳定。</div>
</div>
</div><img src ="http://www.blogjava.net/lyyb2001/aggbug/423658.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lyyb2001/" target="_blank">skycity</a> 2015-03-20 09:40 <a href="http://www.blogjava.net/lyyb2001/archive/2015/03/20/423658.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JDK 和 major.minor version 对应如下 </title><link>http://www.blogjava.net/lyyb2001/archive/2015/03/20/423656.html</link><dc:creator>skycity</dc:creator><author>skycity</author><pubDate>Fri, 20 Mar 2015 01:38:00 GMT</pubDate><guid>http://www.blogjava.net/lyyb2001/archive/2015/03/20/423656.html</guid><wfw:comment>http://www.blogjava.net/lyyb2001/comments/423656.html</wfw:comment><comments>http://www.blogjava.net/lyyb2001/archive/2015/03/20/423656.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lyyb2001/comments/commentRss/423656.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lyyb2001/services/trackbacks/423656.html</trackback:ping><description><![CDATA[&nbsp;J2SE 8 = 52,
<div>&nbsp;J2SE 7 = 51,</div>
<div>&nbsp;J2SE 6.0 = 50,</div>
<div>&nbsp;J2SE 5.0 = 49,</div>
<div>&nbsp;JDK 1.4 = 48,</div>
<div>&nbsp;JDK 1.3 = 47,</div>
<div>&nbsp;JDK 1.2 = 46,</div>
<div>&nbsp;JDK 1.1 = 45</div><img src ="http://www.blogjava.net/lyyb2001/aggbug/423656.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lyyb2001/" target="_blank">skycity</a> 2015-03-20 09:38 <a href="http://www.blogjava.net/lyyb2001/archive/2015/03/20/423656.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>JAVA截取指定字节长度的字符串</title><link>http://www.blogjava.net/lyyb2001/archive/2007/04/11/109792.html</link><dc:creator>skycity</dc:creator><author>skycity</author><pubDate>Wed, 11 Apr 2007 00:10:00 GMT</pubDate><guid>http://www.blogjava.net/lyyb2001/archive/2007/04/11/109792.html</guid><wfw:comment>http://www.blogjava.net/lyyb2001/comments/109792.html</wfw:comment><comments>http://www.blogjava.net/lyyb2001/archive/2007/04/11/109792.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.blogjava.net/lyyb2001/comments/commentRss/109792.html</wfw:commentRss><trackback:ping>http://www.blogjava.net/lyyb2001/services/trackbacks/109792.html</trackback:ping><description><![CDATA[&nbsp;&nbsp;&nbsp;&nbsp; 摘要: &nbsp;&nbsp;<a href='http://www.blogjava.net/lyyb2001/archive/2007/04/11/109792.html'>阅读全文</a><img src ="http://www.blogjava.net/lyyb2001/aggbug/109792.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.blogjava.net/lyyb2001/" target="_blank">skycity</a> 2007-04-11 08:10 <a href="http://www.blogjava.net/lyyb2001/archive/2007/04/11/109792.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>