锘??xml version="1.0" encoding="utf-8" standalone="yes"?>亚洲欧洲免费无码,91亚洲精品自在在线观看,亚洲精品人成网在线播放影院 http://www.tkk7.com/kuuyee/category/49118.htmlwhile (浜у搧+闇姹?璁捐+寮鍙?嫻嬭瘯+閮ㄧ講+鍙戝竷 == doing)
{
CI
} zh-cn Fri, 14 Jun 2013 10:48:06 GMT Fri, 14 Jun 2013 10:48:06 GMT 60 褰揈ffectiveJava閬囪Guava - 浣跨被鍜屾垚鍛樼殑鍙闂ф渶灝忓寲(瑙勫垯13) http://www.tkk7.com/kuuyee/archive/2013/06/14/400560.htmlkuuyee kuuyee Fri, 14 Jun 2013 09:09:00 GMT http://www.tkk7.com/kuuyee/archive/2013/06/14/400560.html http://www.tkk7.com/kuuyee/comments/400560.html http://www.tkk7.com/kuuyee/archive/2013/06/14/400560.html#Feedback 0 http://www.tkk7.com/kuuyee/comments/commentRss/400560.html http://www.tkk7.com/kuuyee/services/trackbacks/400560.html 杞歡璁捐鐨勫熀鏈師鍒欎箣涓錛屽氨鏄郴緇熻妯″潡鍖栵紝妯″潡涔嬮棿鍙氳繃浠栦滑鐨凙PI榪涜閫氫俊錛屼竴涓ā鍧椾笉闇瑕佺煡閬撳叾浠栨ā鍧楃殑鍐呴儴宸ヤ綔鎯呭喌錛岃繖涓蹇電О浣滀俊鎭殣钘?information hiding)鎴栧皝瑁?encapsulation)銆?/span> 闇瑕侀伒瀹堢殑鍘熷垯 灝藉彲鑳藉湴浣挎瘡涓被鎴栨垚鍛樹笉琚鐣岃闂?/strong>鎹㈠彞璇濊錛屽簲璇ヤ嬌鐢ㄤ笌浣犳鍦ㄧ紪鍐欑殑杞歡鐨勫搴斿姛鑳界浉涓鑷淬佸敖鍙兘鏈灝忕殑璁塊棶綰у埆銆?/p>
瀵逛簬欏跺眰鐨?闈炲祵濂楃殑)綾誨拰鎺ュ彛錛屽彧鏈変袱縐嶅彲鑳介潪璁塊棶綰у埆錛岃浠庢槸鍖呯駭縐佹湁鐨勪篃灝辨槸default 錛岃涔堟槸public 鐨?鍖呯駭縐佹湁灝辨剰鍛崇潃瀹冩槸榪欎釜鍖?strong>瀹炵幇鐨勪竴閮ㄥ垎錛屼笉浼氫綔涓鴻鍖匒PI琚鍑猴紝榪欐牱鍦ㄤ互鍚庣殑鍙戝瀷鐗堟湰涓紝瀵瑰畠淇敼銆佹浛鎹€佸垹闄ゅ氨涓嶇敤鎷呭績浼氬獎鍝嶅厛鏈夊鎴風鐨勭▼搴忋?/p>
濡傛灉涓涓寘綰х鏈夌殑欏跺眰綾?鎴栬呮帴鍙?鍙槸鍦ㄦ煇涓涓被鍐呴儴琚敤鍒幫紝灝卞簲璇ヨ冭檻鎶婂畠鍙樻垚鍞竴浣跨敤瀹冪殑閭d釜綾葷殑縐佹湁宓屽綾匯?/p>
闄嶄綆涓嶅繀瑕佸叕鏈夌被鐨勫彲璁塊棶鎬э紝姣旈檷浣庡寘綰х鏈夌殑欏跺眰綾繪洿閲嶈鐨勫錛屽洜涓哄叡鏈夌被鏄疉PI鐨勪竴閮ㄥ垎錛岃屽寘綰х鏈夌殑欏跺眰綾誨凡緇忔槸鍖呭疄鐜扮殑涓閮ㄥ垎浜嗐?/p>
鍙椾繚鎶?protected )鐨勭被鎴栨垚鍛樻槸瀵煎嚭API鐨勪竴閮ㄥ垎錛屽繀欏繪案榪滃緱鍒版敮鎸侊紝搴旇閬垮厤灝介噺灝戠敤銆?/p>
濡傛灉瀛愮被瑕嗙洊浜嗚秴綾葷殑涓涓柟娉曪紝瀛愮被涓殑璁塊棶綰у埆灝變笉鍏佽浣庝簬瓚呯被涓殑璁塊棶綰у埆錛屽惁鍒欎細緙栬瘧閿欒銆傚疄鐜頒簡鎺ュ彛鐨勬墍鏈夋柟娉曚篃蹇呴』鏄叡鏈夌殑錛屽洜涓烘帴鍙d腑鐨勬墍鏈夋柟娉曢兘鏄殣鍚潃鍏辨湁璁塊棶綰у埆銆?/p>
涓轟簡渚夸簬嫻嬭瘯錛屼笉搴旇鎶婂叾璁塊棶綰у埆鎴愪負鍏辨湁鐨勶紝鍙栬屼唬涔嬫槸鎶婃祴璇曠被鎴愪負鍖呯殑涓閮ㄥ垎錛屼粠鑰岃兘澶熻闂畠鐨勫寘綰х鏈夊厓绱犮?/p>
瀹炰緥鍩熷喅涓嶈兘鏄叡鏈夌殑錛屽寘鍚叕鏈夊彲鍙樺煙鐨勭被鍗充究鏄痜inal鐨勪篃涓嶆槸綰跨▼瀹夊叏鐨?/strong>錛?/p>
Note
闀垮害闈為浂鐨勬暟緇勬繪暟鍙彉鐨勶紝鎵浠ワ紝綾誨叿鏈夊叕鏈夌殑闈欐乫inal鏁扮粍鍩燂紝鎴栬呰繑鍥炶繖縐嶅煙鐨勮闂柟娉曪紝榪欏嚑涔庢繪暟閿欒鐨勩?br />
public class UnmodifiableArray { // 娼滃湪瀹夊叏婕忔礊 public static final String [] VALUES = { " RED " , " GREEN " }; public static void main(String [] args) { UnmodifiableArray UF = new UnmodifiableArray(); UF.VALUES[1 ] = " YELLO " ;//璁劇疆final鏁扮粍鎴愬憳 System .out.println(UF); } //浣跨敤Guava @Override public String toString() { return Objects.toStringHelper(this ).add(" VALUES0 " , UnmodifiableArray.VALUES[0 ]) .add(" VALUES1 " , UnmodifiableArray.VALUES[1 ]).toString(); } }
涓婇潰鐨勪緥瀛愰噷錛屾垜浠垚鍔熸洿鏀逛簡涓涓笉鍙彉鏁扮粍錛屾妸鎴愬憳GREEN 淇敼涓?tt>YELLO錛屾墽琛岃緭鍑哄涓嬶細
UnmodifiableArray{VALUES0=RED, VALUES1=YELLO}
鎴戜滑鍙互閫氳繃澧炲姞涓涓笉鍙彉闆嗗悎鍒楄〃鏉ヨВ鍐寵繖涓畨鍏ㄩ棶棰橈紝騫舵妸鍘熸潵public 璁塊棶綰у埆鏀逛負private 鐨勶細
public class UnmodifiableArrayList { // 娑堥櫎瀹夊叏婕忔礊 private static final String [] PRIVATE_VALUES = { " RED " , " GREEN " }; public static final List <String > PVALUES = Collections .unmodifiableList(Arrays .asList(PRIVATE_VALUES)); public static void main(String [] args) { UnmodifiableArrayList UF = new UnmodifiableArrayList(); UF.PVALUES.add(1 , " YELLO " ); //浼氭姏鍑篣nsupportedOperationException寮傚父 System .out.println(UF); } //浣跨敤Guava @Override public String toString() { return Objects.toStringHelper(this ) .add(" PVALUES0 " , UnmodifiableArrayList.PVALUES.get(0 )) .add(" PVALUES1 " , UnmodifiableArrayList.PVALUES.get(1 )) .toString(); } }
鏋勫緩涓涓笉鍙彉闆嗗悎錛孏uava緇欏嚭浜嗘洿綆媧佺殑鍔炴硶錛?/p>
ImmutableList mmutableList = ImmutableList.of(PRIVATE_VALUES);
2013-06-14
]]>Java鍥涘ぇ鍚嶈憲涓嬭澆澶у叏錛堜腑鏂?鑻辨枃錛?/title> http://www.tkk7.com/kuuyee/archive/2013/06/03/400084.htmlkuuyee kuuyee Mon, 03 Jun 2013 00:30:00 GMT http://www.tkk7.com/kuuyee/archive/2013/06/03/400084.html http://www.tkk7.com/kuuyee/comments/400084.html http://www.tkk7.com/kuuyee/archive/2013/06/03/400084.html#Feedback 3 http://www.tkk7.com/kuuyee/comments/commentRss/400084.html http://www.tkk7.com/kuuyee/services/trackbacks/400084.html 鎶芥椂闂存暣鐞嗕簡涓涓婮ava鍥涘ぇ鍚嶈憲錛屽垎浜嚭鏉ユ柟渚垮ぇ瀹跺涔狅紒 Note
閮戦噸澹版槑錛佹湰浜哄己鐑堟敮鎸佹鐗堬紝鍥涘ぇ鍚嶈憲鎴戝凡緇忎拱浜嗕笁鏈紝涓嬭澆鐢靛瓙鐗堝彧鏄柟渚塊槄璇伙紒姣曠珶榪欎箞緇忓吀鐨勪功鏄繀鏀惰棌鐨勶紒
2013-05-30
]]> 褰揈ffectiveJava閬囪Guava - 闈欐佸伐鍘傛柟娉曚唬鏇挎瀯閫犲櫒(瑙勫垯1) http://www.tkk7.com/kuuyee/archive/2013/05/30/399987.htmlkuuyee kuuyee Thu, 30 May 2013 09:09:00 GMT http://www.tkk7.com/kuuyee/archive/2013/05/30/399987.html http://www.tkk7.com/kuuyee/comments/399987.html http://www.tkk7.com/kuuyee/archive/2013/05/30/399987.html#Feedback 1 http://www.tkk7.com/kuuyee/comments/commentRss/399987.html http://www.tkk7.com/kuuyee/services/trackbacks/399987.html Effective Java 涓寚鍑猴紝浣跨敤闈欐佸伐鍘傛柟娉曚唬鏇挎瀯閫犲櫒鏈夊嚑澶т紭鍔匡細 絎竴澶т紭鍔?- 浠栦滑鏈夊悕縐般?/h4>澶氫釜鏋勯犲櫒鍙兘閫氳繃鍖歸厤鍙傛暟綾誨瀷鐨勯『搴忎笉鍚屾潵鍖哄垎浣跨敤鍝竴涓紝榪欐牱甯稿父浼氬鑷寸敤鎴瘋皟鐢ㄩ敊璇瀯閫犲櫒錛岃岄潤鎬佸伐紼嬫柟娉曞垯涓嶅悓錛屽彲浠ラ氳繃鏂規硶鍚嶆竻鏅扮殑鎸囨槑鐢ㄦ剰銆?/p>
//鏈緥鍙敤鏉ヨ鏄庣涓澶т紭鍔匡紝璇蜂笉瑕佺籂緇撳叾瀹冮棶棰?/span> public class Foo { Set <Bar> bars; List <Car> cars; //鏋勯犲櫒1 private Foo(Set <Bar> bars) { this .bars = bars; } //鏋勯犲櫒2 private Foo(List <Car> cars) { this .cars = cars; } //鏋勯犲櫒3 private Foo(Set <Bar> bars, List <Car> cars) { this .bars = bars; this .cars = cars; } //闈欐佸伐鍘傛柟娉? public static Foo newInstanceByBar(){ return new Foo(new HashSet <Bar>()); } //闈欐佸伐鍘傛柟娉? public static Foo newInstanceByCar(){ return new Foo(new ArrayList <Car>()); } //闈欐佸伐鍘傛柟娉? public static Foo newInstanceByAll(){ return new Foo(new HashSet <Bar>(),new ArrayList <Car>()); } public static void main(String [] args) { // 閫氳繃鏋勯犲櫒鍒涘緩瀹炰緥錛屼笉濂藉尯鍒嗗鏄撲嬌鐢ㄩ敊璇?br /> Foo fbar = new Foo(new HashSet <Bar>()); Foo fcar = new Foo(new ArrayList <Car>()); Foo fall = new Foo(new HashSet <Bar>(),new ArrayList <Car>()); // 閫氳繃闈欐佸伐鍘傛柟娉曞彲浠ユ竻鏅扮殑鐢ㄦ柟娉曞悕璇嗗埆 Foo fbar_static = Foo.newInstanceByBar(); Foo fcar_static = Foo.newInstanceByCar(); Foo fall_static = Foo.newInstanceByAll(); } } class Bar {} class Car {}
瀵逛簬Guava錛屽茍娌℃湁鎻愪緵鍒涘緩闈欐佸伐鍘傛柟娉曠殑宸ュ叿錛屼絾鏁翠釜Guava API鍒板閮芥槸闈欐佹柟娉曠殑瀹炵幇錛屾垜浠互Guava Collections Framewrok涓句緥璇存槑銆?/p>
Guava瀵逛簬絎竴澶т紭鍔挎湁寰堝瀹炵幇錛?/p>
List <Type > exactly100 = Lists.newArrayListWithCapacity(100 );List <Type > approx100 = Lists.newArrayListWithExpectedSize(100 ); Set <Type > approx100Set = Sets.newHashSetWithExpectedSize(100 );
絎簩澶т紭鍔?- 涓嶅繀鍦ㄦ瘡嬈¤皟鐢ㄤ粬浠殑鏃跺欓兘鍒涘緩涓涓柊瀵硅薄銆?/h4>鏂逛究瀵硅薄閲嶇敤錛岃繕鍙互紜繚涓嶅彲鍙樼殑涓嶄細瀛樺湪涓や釜鐩哥瓑鐨勫疄渚嬶紝濡傛灉a==b 閭d箞a.equals.(b) 鎵嶄細榪斿洖true ,濡傛灉鑳戒繚璇佽繖涓鐐癸紝灝卞彲浠ヤ嬌鐢?tt>==鎿嶄綔絎︽潵姣旇緝瀵硅薄錛屼細鏈夊緢澶х殑鎬ц兘鎻愬崌銆?/p>
絎笁澶т紭鍔?- 浠栦滑鍙互榪斿洖鍘熻繑鍥炵被鍨嬬殑浠諱綍瀛愮被鍨嬬殑瀵硅薄銆?/h4>API (Service Interface): 鏈嶅姟鍏叡鎺ュ彛 SPI (Service Provider Interface)錛?鏈嶅姟鎻愪緵鍟嗘帴鍙?nbsp;SPF (Service Provider Framework): 鏈嶅姟鎻愪緵妗嗘灦
// 鏈嶅姟鎻愪緵妗嗘灦紺烘剰妯″瀷 - 鏈嶅姟API public interface ServiceAPI { // 榪欓噷鏄湇鍔℃寚瀹氱殑鏂規硶 }// 鏈嶅姟鎻愪緵妗嗘灦紺烘剰妯″瀷 - 鏈嶅姟SPI public interface ServiceSPI { ServiceAPI newService(); } // 鏈嶅姟鎻愪緵妗嗘灦紺烘剰妯″瀷瀹炵幇 // 涓嶅彲瀹炰緥鍖栫殑綾伙紝鐢ㄦ潵娉ㄥ唽鍒涘緩鍜屾彁渚涜闂?/span> public class ServiceFramework { private ServiceFramework() { }// 寮哄埗闃叉瀹炰緥鍖栵紙瑙勫垯4錛?br /> // 鏄犲皠鏈嶅姟鍚嶅埌鏈嶅姟 private static final ConcurrentMap <String , ServiceSPI> spis = new MapMaker().makeMap();//浣跨敤Guava鍒涘緩 public static final String DEFAULT_SPI_NAME = " <def> " ; // 榛樿SPI娉ㄥ唽API public static void registerDefaultSPI(ServiceSPI spi) { registerSPI(DEFAULT_SPI_NAME, spi); } // 鎸囧畾SPI娉ㄥ唽API public static void registerSPI(String name, ServiceSPI spi) { spis.put(name, spi); } // 鏈嶅姟璁塊棶API public static ServiceAPI newInstance() { return newInstance(DEFAULT_SPI_NAME); } public static ServiceAPI newInstance(String name) { ServiceSPI spi = spis.get(name); if (spi == null ) throw new IllegalArgumentException ( " No provider registered with name: " + name); return spi.newService(); } }
Note
闈欐佸伐紼嬫柟娉曡繑鍥炵殑瀵硅薄鎵灞炵殑綾伙紝鍦ㄧ紪鍐欒繖涓寘鍚潤鎬佸伐鍘傛柟娉曠殑綾繪椂鍙互涓嶅繀瀛樺湪銆備笂闈㈢殑渚嬪瓙鍦ㄧ紪鍐橲erviceFramework綾繪椂錛孲erviceAPI鐨勫疄鐜扮被騫朵笉瀛樺湪銆傝繖澶уぇ澧炲姞浜嗘鏋剁殑鐏墊椿鎬с?/strong>
// 綆鍗曠殑鏈嶅姟鎻愪緵妗嗘灦嫻嬭瘯紼嬪簭 public class Test { public static void main(String [] args) { // 鏈嶅姟鎻愪緵鍟嗘墽琛屼笅闈㈢殑娉ㄥ唽 ServiceFramework.registerDefaultSPI(DEFAULT_PROVIDER); ServiceFramework.registerSPI(" comp " , COMP_PROVIDER); ServiceFramework.registerSPI(" armed " , ARMED_PROVIDER); // 瀹㈡埛绔墽琛屼笅闈㈢殑鍒涘緩 ServiceAPI s1 = ServiceFramework.newInstance(); ServiceAPI s2 = ServiceFramework.newInstance(" comp " ); ServiceAPI s3 = ServiceFramework.newInstance(" armed " ); System .out.printf(" %s, %s, %s%n " , s1, s2, s3); } private static ServiceSPI DEFAULT_PROVIDER = new ServiceSPI() { public ServiceAPI newService() { return new ServiceAPI() { @Override public String toString() { return " 榛樿鏈嶅姟 " ; } }; } }; private static ServiceSPI COMP_PROVIDER = new ServiceSPI() { public ServiceAPI newService() { return new ServiceAPI() { @Override public String toString() { return " Complementary 鏈嶅姟 " ; } }; } }; private static ServiceSPI ARMED_PROVIDER = new ServiceSPI() { public ServiceAPI newService() { return new ServiceAPI() { @Override public String toString() { return " Armed 鏈嶅姟 " ; } }; } }; } //杈撳嚭濡備笅 榛?/span>璁?/span>鏈?/span>鍔?/span>, Complementary 鏈?/span>鍔?/span>, Armed 鏈?/span>鍔?/span>
絎洓澶т紭鍔?- 鍦ㄥ垱寤哄弬鏁板寲綾誨瀷瀹炰緥鐨勬椂鍊欙紝浠栦滑浣夸唬鐮佸彉寰楁洿鍔犵畝媧併?/h4>鍦↗DK7涔嬪墠錛屾垜浠垱寤轟竴涓狢ollections澶ц嚧鏄繖涔堝仛鐨勶細
List <TypeThatsTooLongForItsOwnGood> list = new ArrayList <TypeThatsTooLongForItsOwnGood>();
JDK7鍙戝竷浠ュ悗錛屾垜浠彲浠ョ畝鍖栨垚榪欐牱錛?/p>
List <TypeThatsTooLongForItsOwnGood> list = new ArrayList <>();
浣嗘槸Guava榪樻槸瀹佹効浣跨敤闈欐佸伐紼嬫柟娉曪紝鍥犱負鐪熺殑闈炲父鏂逛究錛?/p>
Set <Type > copySet = Sets.newHashSet(elements); List <String > theseElements = Lists.newArrayList(" alpha " , " beta " , " gamma " );
闈欐佸伐紼嬫柟娉曠殑緙虹偣 綾誨鏋滀笉鍚叕鏈夌殑鎴栬呭彈淇濇姢鐨勬瀯閫犲櫒錛屽氨涓嶈兘琚瓙綾誨寲錛岃繖涔熻浼氬洜紲稿緱紱忥紝鍥犱負瀹冮紦鍔卞紑鍙戜漢鍛樹嬌鐢ㄥ鍚堬紝鑰屼笉鏄戶鎵褲?/p>
浠栦滑涓庡叾浠栫殑闈欐佹柟娉曞疄闄呬笂娌℃湁浠諱綍鍖哄埆 濡傛灉API鏂囨。娌℃湁鏄庣‘鐨勮鏄庤繖鏄竴涓潤鎬佸伐紼嬫柟娉曪紝灝變細寰堥毦璇嗗埆鍑烘潵銆傞伒寰爣鍑嗙殑鍛藉悕瑙勮寖涔犳儻錛屽彲浠ュ譏琛ヨ繖涓鍔e娍錛屼笅闈㈠垪鍑轟竴浜涙儻鐢ㄥ懡鍚嶏細
valueOf - 榪欐牱鐨勯潤鎬佸伐鍘傛柟娉曞疄闄呬笂鏄被鍨嬭漿鎹?/p>
of - valueOf鐨勭畝媧佹柟寮?/p>
getInstance - 榪斿洖瀹炰緥閫氳繃鏂規硶鍙傛暟鎻忚堪錛屽浜庡崟渚嬶紝璇ユ柟娉曟病鏈夊弬鏁幫紝騫惰繑鍥炲敮涓鐨勫疄渚?/p>
newInstance - 涓巊etInstance涓嶅悓鐨勬槸錛屽畠榪斿洖鐨勫疄渚嬩笌鎵鏈夊叾瀹冨疄渚嬮兘鏄笉鍚岀殑
getType - 鍍廹etInstance涓鏍鳳紝浣嗘槸鍦ㄥ伐鍘傛柟娉曞浜庝笉鍚岀殑綾諱腑鐨勬椂鍊欎嬌鐢ㄣ俆ype琛ㄧずi榪斿洖瀵硅薄綾誨瀷
newType - 鍍弉ewInstance涓鏍鳳紝浣嗘槸鍦ㄥ伐鍘傛柟娉曞浜庝笉鍚岀殑綾諱腑鐨勬椂鍊欎嬌鐢ㄣ俆ype琛ㄧずi榪斿洖瀵硅薄綾誨瀷
2013-05-29
]]>褰揈ffectiveJava閬囪Guava - toString(瑙勫垯10) http://www.tkk7.com/kuuyee/archive/2013/05/29/399914.htmlkuuyee kuuyee Wed, 29 May 2013 03:40:00 GMT http://www.tkk7.com/kuuyee/archive/2013/05/29/399914.html http://www.tkk7.com/kuuyee/comments/399914.html http://www.tkk7.com/kuuyee/archive/2013/05/29/399914.html#Feedback 2 http://www.tkk7.com/kuuyee/comments/commentRss/399914.html http://www.tkk7.com/kuuyee/services/trackbacks/399914.html 鎴戜滑閮界煡閬揓ava涔︾睄鏈夊洓澶у悕钁楋紝鍏朵腑 Effective Java 鍙互璇存槸楂樻墜榪涢樁蹇呯湅鐨勶紝浣滆?nbsp; Joshua Bloch 鏄疓oogle鐨勯甯璊ava鏋舵瀯甯堬紝濡傛灉鎶?James Gosling縐頒負Java涔嬬埗錛岄偅涔圝oshua Bloch灝卞儚鏄疛ava涔嬫瘝錛屾槸浠栨妸Java鍏昏偛鎴愪漢銆備箣鍓嶆浘鏈変漢璁ㄨ榪嘒oogle鏈夊緢澶氱紪鐮佽鑼冿紝涓轟粈涔堝敮鐙病鏈塉ava鐗堢殑闂錛屾渶緇堢殑緇撹灝辨槸錛?/span>Google鐨凧ava緙栫爜瑙勮寖灝辨槸 Effective Java涓涔?/strong>錛屽彲瑙佹涔︽湁澶氫箞閲嶈銆傜幇鍦℅oogle鍙堟帹鍑轟簡寮哄ぇ濂界敤鐨凧ava閫氱敤綾誨簱 Guava 錛屽叕璁や負姣擜pache Common濂界敤錛屽洜涓篈pache瑕佸吋瀹硅佺増鏈紝鎵浠ュΘ紕嶄簡寰堝Java鐨勬柊鐗規х殑浣跨敤銆?/span> 鏃㈢劧Effective Java鍜孏uava閮借癁鐢熶簬Google錛岄偅涔堝綋浠栦滑鐩擱亣浼氫粈涔堟牱鍛紝涓烘鎴戝喅瀹氶噸娓〦ffective Java榪欓儴钁椾綔錛屽茍閽堝姣忎竴鏉¤鍒欏鎵綠uava緇欏嚭鐨勮В鍐蟲柟妗堬紝甯屾湜鑳芥洿娣卞叆鐨勬帉鎻ava銆?/p>
涓嬮潰鎴戞妸Effective Java鐨勬牱渚嬩唬鐮佸垪鍑猴紝騫剁敤Guava閲嶆柊浜?tt>toString鏂規硶
// 閲嶅啓PhoneNumber鐨則oString鏂規硶 - Effective Java涓枃絎簩鐗堢44欏?/span>
package org.effectivejava.examples.chapter03.item10 ;
import java.util.HashMap ;
import java.util.Map ;
import com.google.common.base.Objects ;
public final class PhoneNumber {
private final short areaCode;
private final short prefix;
private final short lineNumber;
public PhoneNumber(int areaCode, int prefix, int lineNumber) {
rangeCheck(areaCode, 999 , " area code " );
rangeCheck(prefix, 999 , " prefix " );
rangeCheck(lineNumber, 9999 , " line number " );
this .areaCode = (short ) areaCode;
this .prefix = (short ) prefix;
this .lineNumber = (short ) lineNumber;
}
private static void rangeCheck(int arg, int max, String name) {
if (arg < 0 || arg > max)
throw new IllegalArgumentException (name + " : " + arg);
}
@Override
public boolean equals(Object o) {
if (o == this )
return true ;
if (!(o instanceof PhoneNumber))
return false ;
PhoneNumber pn = (PhoneNumber) o;
return pn.lineNumber == lineNumber && pn.prefix == prefix
&& pn.areaCode == areaCode;
}
@Override
public int hashCode() {
int result = 17 ;
result = 31 * result + areaCode;
result = 31 * result + prefix;
result = 31 * result + lineNumber;
return result;
}
//Effective Java鍘熸湁鐨則oString鏂規硶
/*
* @Override public String toString() { return
* String.format("(%03d) %03d-%04d", areaCode, prefix, lineNumber); }
*/
/**
* 閲囩敤Guava瀹炵幇鐨則oString
*
*/
@Override
public String toString() {
return Objects.toStringHelper(this )
.addValue(String .format(" (%03d) %03d-%04d " , areaCode, prefix,lineNumber))
.add(" areaCode " , areaCode)
.add(" prefix " , prefix)
.add(" lineNumber " , lineNumber)
.toString();
}
public static void main(String [] args) {
Map <PhoneNumber, String > m = new HashMap <PhoneNumber, String >();
m.put(new PhoneNumber(707 , 867 , 5309 ), " Jenny " );
System .out.println(m);
}
}
杈撳嚭瀵規瘮
//鍘熻緭鍑?br /> {(707 ) 867 -5309 =Jenny} //Guava瀹炵幇杈撳嚭 {PhoneNumber{(707 ) 867 -5309 , areaCode=707 , prefix=867 , lineNumber=5309 }=Jenny}
2013-05-24
]]>CDI鍦↗avaEE7涓崰鎹姝ら噸瑕佺殑鍦頒綅錛?/title> http://www.tkk7.com/kuuyee/archive/2013/05/17/399413.htmlkuuyee kuuyee Fri, 17 May 2013 07:40:00 GMT http://www.tkk7.com/kuuyee/archive/2013/05/17/399413.html http://www.tkk7.com/kuuyee/comments/399413.html http://www.tkk7.com/kuuyee/archive/2013/05/17/399413.html#Feedback 0 http://www.tkk7.com/kuuyee/comments/commentRss/399413.html http://www.tkk7.com/kuuyee/services/trackbacks/399413.html
浠庝笅闈㈢殑JavaEE7鏂扮壒鎬у垪琛ㄤ腑錛屼綘浼氬彂鐜癈DI鏄涔堢殑閲嶈錛屽畠鏃犲涓嶅湪錛?/span> 鍒板閮芥爣紺虹潃“ CDI Integration ”錛屾湰鏂囨憳鑷?nbsp; 榪欓噷
EJB 3.2
Enterprise Java Bean 3.2 (JSR 345)
Enhancing EJB architecture to enable the PaaS model with features such as multi-tenancy
Factorization of container-managed transactions to use other component technologies of the Java EE platform
Enhanced use of annotations to simplify EJB programming model
Alignment and integration with other specifications related to JSRs within the Java EE 7 platform such asCDI
, JMS, Bean Validation, etc
EL 3.0
Expression Language 3.0 (JSR 341)
Separate expression language context into parsing and evaluation contexts independent of the JSP specification
Introduction of new customizable expression language coercion rules
Reference static methods and members directly in EL expressions without having to define them in Tag Library Descriptor, similar to instance method invocation
Adding equality, string concatenation, and sizeof operators
CDI
Integration so that +events+ can be generated before/during/after the expressions are evaluated
JMS 2.0
Java Messaging Service 2.0 (JSR 343) The new introduction will be an evolution of the previous version, JSR-914.
Enhanced JMS programming model to make application development easier, cleaning up ambiguities in the present specification
Enhanced integration with CDI
for easier and more unified use of API
Make necessary changes to API in allowing any JMS provider to integrate with any Java EE containerinvocation
Make JSR more cloud-friendly, leveraging multi-tenancy and other cloud-related features from the platform
EL 3.0
Expression Language 3.0 (JSR 341)
Separate expression language context into parsing and evaluation contexts independent of the JSP specification
Introduction of new customizable expression language coercion rules
Reference static methods and members directly in EL expressions without having to define them in Tag Library Descriptor, similar to instance method invocation
Adding equality, string concatenation, and sizeof operators
CDI
Integration so that events can be generated before/during/after the expressions are evaluated
Servlet 3.1
Java Servlet 3.2 (JSR 340) Servlet鏃╁湪JavaEE6灝卞凡緇忔棤緙濋泦鎴愪簡 CDI
Optimize Java EE PaaS model, leveraging the cloud for Web applications
Optimizing PaaS model leveraging multi-tenancy. To support this into the Web container, the main areas of optimization will be security, session state, resources and
other multi-tenant awareness requirements for Web applications.
Enhance the asynchronous support of Servlet 3.0 and simplify further in building asynchronous applications
Utilize Java EE concurrency APIs for asynchronous support
Enhance the Servlet 3.0 built-in security features
Optimize the built-in plug-ability support of Servlet 3.0
Focus on providing necessary functionality for building easier-to-use, high-level protocol support for Web Sockets and other protocols that work with HTTP in the Servlet API
JAX-RS 2.0
Java API for RESTful Web Services 2.0 (JSR 339)
Define two client APIs, both REST-compatible -- a low-level API using builder pattern and a higher-level API leveraging the low-level APIs
Hypermedia, an important RESTful feature of Web applications, will be easy to create, and it will process links associated with resources in representation either as a header or as a links within the entity peripheral.
Make it possible to validate parameters of forms or query using bean validation and return a meaningful response on failure to validate
Closer integration CDI
@Inject
JSF 2.2
Java Server Faces 2.2 (JSR 344)
Making configuration options dynamic, eliminate tag handler class even for non-composite JSP components, introduce shorthand URLs for Facelet Tag Libraries, make cc:interface in composite components optional, enhance deployment, integrate with CDI
Component identification and Ajax
Support implementation of Portlet Bridge 2.0
Support for HTML5 features, such as Forms, Heading, Metadata and Section content model, Flow management, Listener for page navigation events, and new components like FileUpload and BackButton
CDI 1.1
Context and Dependency Injection 1.1 (JSR 346)
Global ordering of interceptors and decorators,
API for managing built-in context,
Embedded mode to allow startup outside the Java EE container
Declarative control over which packages/classes are scanned in a bean archive
Bean declaration at constructor level
Injection for static members, such as loggers
Send CDI
events for Servlet events
Better support for CDI
in libraries when used in the Java EE platform
JPA 2.1
Java Persistence API 2.1 (JSR 338)
Addition of the javax.persistence.StoredProcedureQuery interface to control stored procedure query execution. >Javax.persistence.EntityManager has added four variants of methods that return a StoredProcedureQuery for executing a stored procedure, including one allowing named stored procedure query. The newly introduced annotation @NamedStoredProcedureQuery can be specified on an entity or mapped class, similar to the @NamedQuery. The parameters IN, OUT and INOUT can be used to manipulate values from the stored procedure.
The javax.persistence.criteria.AbstractQuery interface has been refactored by CriteriaUpdate, CriteriaDelete and CommonAbstractQuery interfaces.
Added new identifiers for persistence query language (JPQL), such as FUNCTION for supporting JPQL built-in functions, TREAT for down casting within path expressions in the FROM and WHERE clauses, and ON for specifying the relationship between the tables.
CDI
Integration Listener.The entity listeners can be annotated with @PostConstruct and @PostDestroy for their lifecycle. Also, the usual lifecycle callback methods, such as @PrePersist, @PostPersist, @PreUpdate and @PreRemove can be used for entities.
Added support for unsynchronized persistence context to create container-managed unsynchronized persistence context. For example, @PersistenceContext (synchronization=SynchronizationType.UNSYNCHRONIZED)
Bean Validation 1.1
Bean Validation 1.1 (JSR 349)
Integration with other Java EE specs錛?nbsp;CDI
etc.
APIs to validate parameters and return values of method calls.
Validate parameters and return values on HTTP calls
Ability to translate a group into another group while cascading the validation
APIs to validate parameters and return values of method calls
Apply constraints on group collection
Extend the model to support AND and OR style composition
]]> CDI(JSR-346)-JavaEE騫沖彴涓婁笅鏂囦緷璧栨敞鍏ヨ鑼?1.1 鏂扮壒鎬?/title> http://www.tkk7.com/kuuyee/archive/2013/05/09/399037.htmlkuuyee kuuyee Thu, 09 May 2013 03:47:00 GMT http://www.tkk7.com/kuuyee/archive/2013/05/09/399037.html http://www.tkk7.com/kuuyee/comments/399037.html http://www.tkk7.com/kuuyee/archive/2013/05/09/399037.html#Feedback 0 http://www.tkk7.com/kuuyee/comments/commentRss/399037.html http://www.tkk7.com/kuuyee/services/trackbacks/399037.html 涓昏鍔熻兘鏀硅繘 榪欎簺涓昏鍔熻兘鏀瑰彉宸茬粡鍦–DI 1.1涓紩鍏ワ細
鍔犲叆鍏ㄥ眬鎷︽埅鍣?(鍙傞槄Java Interceptors Specification 1.2)錛?鍏ㄥ眬瑁呴グ鍣?鍜屼嬌鐢?tt>@Priority娉ㄨВ瀹炵幇鏇夸唬閫夋嫨
緇欐敞瑙d負@AroundConstruct 鐨勬瀯閫犲櫒鍔犲叆鐢熷懡鍛ㄦ湡鍥炶皟鏀寔 (鍙傞槄 Java Interceptors Specification 1.2)
鍏佽緇戝畾鎷︽埅鏋勯犲櫒
鎷︽埅鍣ㄧ粦瀹氱Щ鍏ユ嫤鎴櫒瑙勮寖錛屼互渚涘叾瀹冭鑼冧嬌鐢?/p>
Beans鍐呭緩鏀寔瑁呴グ鍣?nbsp;
鍔犲叆EventMetadata 鍏佽浜嬩歡鍏冩暟鎹鏌?/p>
鍔犲叆 @Vetoed 娉ㄨВ璁〤lasses澶卞幓鍘熸湁紼嬪簭鑳藉姏
寰堝鏀硅繘鏉ュ己鍖朾eans鍔熻兘錛屽寘鎷?nbsp;@TransientReference 娉ㄨВ鍏佽淇濈暀瀹炲姏緇欒皟鐢ㄥ畠鐨勬柟娉曟垨鏋勯犲嚱鏁?nbsp;
鍔犲叆嬋媧誨拰閿姣佸懆鏈熺殑浜嬩歡鍥炶皟
鍔犲叆 AlterableContext 鍏佽bean瀹炰緥琚槑紜殑閿姣?/p>
緇檅ean鍦ㄥ懆鏈熸敞瑙c丒JB銆佸湪JavaEE涓嚜鍚姩CDI鍔熻兘
鍦?nbsp;bean.xml 涓姞鍏lass榪囨護鎺掗櫎錛屼互闃叉鎵弿classes鍜宲ackage
鍔犲叆 Unmanaged 鍏佽鏂逛究鐨勮闂棤涓婁笅鏂囩殑bean瀹炰緥
鍔犲叆 CDI 浠ユ柟渚跨殑璁塊棶褰撳墠鐨凜DI瀹瑰櫒
鍔犲叆 AfterTypeDiscovery 浜嬩歡錛屽厑璁稿湪綾誨瀷鍙戠幇涔嬪悗鎵╁睍闄勫姞娉ㄥ唽
鍔犲叆 @WithAnnotation 娉ㄨВ浣滀負涓縐嶆敼鍠勮礋杞芥ц兘鐨勬柟寮?/p>
鍦ㄤ究鎼虹殑鎵╁睍鍔犲叆寰堝嬈¤鐨勬敼榪?/p>
2013-05-09
]]> Eclipse閰嶈壊鏂規鎻掍歡 鐪熸紓浜紒 http://www.tkk7.com/kuuyee/archive/2013/02/26/395728.htmlkuuyee kuuyee Tue, 26 Feb 2013 02:43:00 GMT http://www.tkk7.com/kuuyee/archive/2013/02/26/395728.html http://www.tkk7.com/kuuyee/comments/395728.html http://www.tkk7.com/kuuyee/archive/2013/02/26/395728.html#Feedback 3 http://www.tkk7.com/kuuyee/comments/commentRss/395728.html http://www.tkk7.com/kuuyee/services/trackbacks/395728.html 鏈榪戝彂鐜頒簡涓涓狤clipse閰嶈壊鏂規鎻掍歡錛岃繖鍥炵粰Eclipse閰嶈壊澶柟渚夸簡銆?/p>鎻掍歡涓婚〉錛?a style="color: #0088cc; text-decoration: initial;">http://eclipsecolorthemes.org/
鎻掍歡鎻愪緵浜嗕笂涓囩閰嶈壊鏂規錛岄潪甯告紓浜紝涓婂浘鐪嬩笅錛?/p>
瀹夎寰堢畝鍗曪紝鎵撳紑 Eclipse Marketplace
鏌ユ壘 Eclipse Color Theme 錛屼細鎵懼埌榪欎釜鎻掍歡銆?/p>
瀹夎瀹屾垚鍚庤繘鍏?nbsp;Preferences —> Appearance —> Color Theme 灝卞彲閫夋嫨涓婚浜?/p>
]]> Jboss Seam2.3.0.BETA1鍙戝竷 http://www.tkk7.com/kuuyee/archive/2012/04/08/373585.htmlkuuyee kuuyee Sun, 08 Apr 2012 12:00:00 GMT http://www.tkk7.com/kuuyee/archive/2012/04/08/373585.html http://www.tkk7.com/kuuyee/comments/373585.html http://www.tkk7.com/kuuyee/archive/2012/04/08/373585.html#Feedback 0 http://www.tkk7.com/kuuyee/comments/commentRss/373585.html http://www.tkk7.com/kuuyee/services/trackbacks/373585.html Jboss鍦?鏈?0鍙峰彂甯冧簡 Seam2.3.0.BETA1錛?/span>Release Notes濡備笅錛?br />淇浜嗗ぇ閲忕殑Bug 鍏ㄩ潰鏀寔JSF2 鍔犲叆 bean validation 鍜?EJB 3.1 鐨勬敮鎸?/li> 鍗囩駭Drools鐗堟湰鑷?.1 鍗囩駭Junit鐗堟湰鑷? 鏇存柊澶ч噺渚嬪瓙鏀寔JSF2 Jboss Seam璁″垝鍦ㄨ繖涓湀鍙戝竷鍙︿竴涓噷紼嬬 2.3.0.Beta2錛岄愭瀹屽杽 Arquillian 鍜?Seam Gen 鐗規с傚叾鍚庡氨闆嗕腑鍦?2.3.0 鐨凚UG 淇涓娿?nbsp;
涓嬭澆錛?/span>http://www.seamframework.org/Seam2/Downloads 鏂囨。錛?/span>http://www.seamframework.org/Seam2/Seam2Documentation. ]]> 鐢╓eblogic WLST鑴氭湰 榪滅▼閮ㄧ講Web搴旂敤 http://www.tkk7.com/kuuyee/archive/2011/10/13/361213.htmlkuuyee kuuyee Thu, 13 Oct 2011 15:46:00 GMT http://www.tkk7.com/kuuyee/archive/2011/10/13/361213.html http://www.tkk7.com/kuuyee/comments/361213.html http://www.tkk7.com/kuuyee/archive/2011/10/13/361213.html#Feedback 1 http://www.tkk7.com/kuuyee/comments/commentRss/361213.html http://www.tkk7.com/kuuyee/services/trackbacks/361213.html 1 import re 2 3 warPath = ' helloWebApp ' 4 serverUrl = ' t3://192.168.1.100:7001 ' 5 username = ' weblogic ' 6 password = ' weblogic ' 7 targetServer = " examplesServer " 8 deployAppName = ' DeployExample2 ' 9 10 11 connect(username, password, serverUrl) 12 13 appList = re.findall(deployAppName, ls( ' /AppDeployments ' )) 14 print " ========================= " 15 print len(appList) 16 if len(appList) > 0: 17 # oldestArchiveVersion = min(map(int, appList)) 18 print ' come in!!! ' 19 undeploy(deployAppName) 20 21 # deploy(appName='DeployExample', path = 'helloWebApp', targets = 'examplesServer',timeout=600000, block = 'true') 22 23 deploy(deployAppName, warPath, targets = targetServer, securityModel = " Advanced " ,timeout = 600000 , block = " true " ) 24 exit()
Ok ]]>JBoss AS7閰嶇疆MySQL鏁版嵁婧?/title> http://www.tkk7.com/kuuyee/archive/2011/07/19/354598.htmlkuuyee kuuyee Tue, 19 Jul 2011 02:49:00 GMT http://www.tkk7.com/kuuyee/archive/2011/07/19/354598.html http://www.tkk7.com/kuuyee/comments/354598.html http://www.tkk7.com/kuuyee/archive/2011/07/19/354598.html#Feedback 4 http://www.tkk7.com/kuuyee/comments/commentRss/354598.html http://www.tkk7.com/kuuyee/services/trackbacks/354598.html 闃呰鍏ㄦ枃 ]]> JBoss AS7 鍙戝竷 http://www.tkk7.com/kuuyee/archive/2011/07/13/354224.htmlkuuyee kuuyee Wed, 13 Jul 2011 01:43:00 GMT http://www.tkk7.com/kuuyee/archive/2011/07/13/354224.html http://www.tkk7.com/kuuyee/comments/354224.html http://www.tkk7.com/kuuyee/archive/2011/07/13/354224.html#Feedback 0 http://www.tkk7.com/kuuyee/comments/commentRss/354224.html http://www.tkk7.com/kuuyee/services/trackbacks/354224.html 闃呰鍏ㄦ枃 ]]> JavaEE6 FAQs 涔婡Model http://www.tkk7.com/kuuyee/archive/2011/07/12/354161.htmlkuuyee kuuyee Tue, 12 Jul 2011 06:14:00 GMT http://www.tkk7.com/kuuyee/archive/2011/07/12/354161.html http://www.tkk7.com/kuuyee/comments/354161.html http://www.tkk7.com/kuuyee/archive/2011/07/12/354161.html#Feedback 0 http://www.tkk7.com/kuuyee/comments/commentRss/354161.html http://www.tkk7.com/kuuyee/services/trackbacks/354161.html 闃呰鍏ㄦ枃 ]]> (緲昏瘧)JavaEE6瑙勮寖 CDI鏁欑▼絎簲閮ㄥ垎 http://www.tkk7.com/kuuyee/archive/2011/07/12/354145.htmlkuuyee kuuyee Tue, 12 Jul 2011 02:38:00 GMT http://www.tkk7.com/kuuyee/archive/2011/07/12/354145.html http://www.tkk7.com/kuuyee/comments/354145.html http://www.tkk7.com/kuuyee/archive/2011/07/12/354145.html#Feedback 0 http://www.tkk7.com/kuuyee/comments/commentRss/354145.html http://www.tkk7.com/kuuyee/services/trackbacks/354145.html 闃呰鍏ㄦ枃 ]]> (緲昏瘧)JavaEE6瑙勮寖 CDI鏁欑▼絎洓閮ㄥ垎 http://www.tkk7.com/kuuyee/archive/2011/06/28/353291.htmlkuuyee kuuyee Tue, 28 Jun 2011 10:26:00 GMT http://www.tkk7.com/kuuyee/archive/2011/06/28/353291.html http://www.tkk7.com/kuuyee/comments/353291.html http://www.tkk7.com/kuuyee/archive/2011/06/28/353291.html#Feedback 4 http://www.tkk7.com/kuuyee/comments/commentRss/353291.html http://www.tkk7.com/kuuyee/services/trackbacks/353291.html 闃呰鍏ㄦ枃 ]]> Maven欏圭洰甯歌闂瀹炴垬(涓) 瑙e喅鐩鎬簰渚濊禆 http://www.tkk7.com/kuuyee/archive/2011/06/28/353158.htmlkuuyee kuuyee Tue, 28 Jun 2011 04:40:00 GMT http://www.tkk7.com/kuuyee/archive/2011/06/28/353158.html http://www.tkk7.com/kuuyee/comments/353158.html http://www.tkk7.com/kuuyee/archive/2011/06/28/353158.html#Feedback 1 http://www.tkk7.com/kuuyee/comments/commentRss/353158.html http://www.tkk7.com/kuuyee/services/trackbacks/353158.html 闃呰鍏ㄦ枃 ]]> (緲昏瘧)JavaEE6瑙勮寖 CDI鏁欑▼絎笁閮ㄥ垎 http://www.tkk7.com/kuuyee/archive/2011/06/20/352650.htmlkuuyee kuuyee Mon, 20 Jun 2011 03:43:00 GMT http://www.tkk7.com/kuuyee/archive/2011/06/20/352650.html http://www.tkk7.com/kuuyee/comments/352650.html http://www.tkk7.com/kuuyee/archive/2011/06/20/352650.html#Feedback 1 http://www.tkk7.com/kuuyee/comments/commentRss/352650.html http://www.tkk7.com/kuuyee/services/trackbacks/352650.html 闃呰鍏ㄦ枃 ]]> (緲昏瘧)JavaEE6瑙勮寖 CDI鏁欑▼絎簩閮ㄥ垎 http://www.tkk7.com/kuuyee/archive/2011/06/17/352490.htmlkuuyee kuuyee Fri, 17 Jun 2011 03:10:00 GMT http://www.tkk7.com/kuuyee/archive/2011/06/17/352490.html http://www.tkk7.com/kuuyee/comments/352490.html http://www.tkk7.com/kuuyee/archive/2011/06/17/352490.html#Feedback 0 http://www.tkk7.com/kuuyee/comments/commentRss/352490.html http://www.tkk7.com/kuuyee/services/trackbacks/352490.html 闃呰鍏ㄦ枃 ]]> (緲昏瘧)JavaEE6瑙勮寖 CDI鏁欑▼絎竴閮ㄥ垎 http://www.tkk7.com/kuuyee/archive/2011/06/16/352421.htmlkuuyee kuuyee Thu, 16 Jun 2011 06:03:00 GMT http://www.tkk7.com/kuuyee/archive/2011/06/16/352421.html http://www.tkk7.com/kuuyee/comments/352421.html http://www.tkk7.com/kuuyee/archive/2011/06/16/352421.html#Feedback 1 http://www.tkk7.com/kuuyee/comments/commentRss/352421.html http://www.tkk7.com/kuuyee/services/trackbacks/352421.html CDI鏄嬩緷鈥嬭禆鈥嬫敞鈥嬪叆鈥?DI)鍜屸嬫嫤鈥嬫埅鈥?AOP)鐨勨婮ava鏍団嬪噯鈥嬭鈥嬭寖鈥嬨傗婦I鍜屸婣OP鏈夆嬬潃鈥嬪緢鈥嬮珮鈥嬬殑鈥嬬煡鈥嬪悕鈥嬪害鈥嬶紝Java闇鈥嬭鈥嬪鈥嬬悊鈥婦I鍜屸婣OP浠モ嬩究鈥嬪湪鈥嬫鈥嬩箣鈥嬩笂鈥嬫瀯鈥嬪緩鈥嬪叾鈥嬪畠鈥嬬殑鈥嬫爣鈥嬪噯鈥嬨傗婦I鍜屸婣OP鏄嬪緢鈥嬪鈥婮ava妗嗏嬫灦鈥嬬殑鈥嬪熀鈥嬬鈥嬨傗? CDI鏄婮avaEE 6鐨勨嬪熀鈥嬬鈥嬨傗嬪畠鈥嬪緢鈥嬪揩鈥嬪氨鈥嬪緱鈥嬪埌鈥嬩簡鈥婥aucho's Resin銆佲婭BM's WebSphere銆佲婳racle's Glassfish銆佲婻ed Hat's JBoss鍜屸嬩紬鈥嬪鈥嬪簲鈥嬬敤鈥嬫湇鈥嬪姟鈥嬪櫒鈥嬬殑鈥嬫敮鈥嬫寔鈥嬨傗婥DI涓庘婼pring鍜屸婫uice妗嗏嬫灦鈥嬮潪鈥嬪父鈥嬬浉鈥嬩技鈥嬶紝灝扁嬪儚鈥婮PA寰堚嬪儚鈥婳RM銆傗婥DI綆鈥嬪寲鈥嬩簡鈥嬪鈥嬩簬鈥婦I鍜屸婣OP鐨勨婣PI銆傗嬪鈥嬫灉鈥嬩綘鈥嬩嬌鈥嬬敤鈥嬭繃鈥婼pring鎴栤嬭呪婫uice錛屼綘鈥嬩細鈥嬪彂鈥嬬幇鈥婥DI鏇粹嬪鈥嬫槗 闃呰鍏ㄦ枃 ]]> Ceylon璇█浠嬬粛絎竴閮ㄥ垎錛堢炕璇戯級鈥斺擧ibernate涔嬬埗鐨勫張涓鍔涗綔 http://www.tkk7.com/kuuyee/archive/2011/05/24/350885.htmlkuuyee kuuyee Mon, 23 May 2011 23:25:00 GMT http://www.tkk7.com/kuuyee/archive/2011/05/24/350885.html http://www.tkk7.com/kuuyee/comments/350885.html http://www.tkk7.com/kuuyee/archive/2011/05/24/350885.html#Feedback 1 http://www.tkk7.com/kuuyee/comments/commentRss/350885.html http://www.tkk7.com/kuuyee/services/trackbacks/350885.html Ceylon鏄竴闂ㄦ柊鐨勮璦錛屽畠榪愯鍦↗ava铏氭嫙鏈轟笂錛岀洰鍓嶆鏈夋垜鎵鍦ㄧ殑灝忕粍寮鍙戯紝瀹冮毝灞炰簬RedHat銆傛垜浠兘鏄疛ava鍜孞ava鐢熸佺郴緇熺殑綺変笣錛屽洜涓哄畠鐨勫疄鐢ㄦс佸箍闃旂殑鏂囧寲姘涘洿鍜屽紑鍙戠ぞ鍖恒佸ぉ鐢熼傜敤浜庡晢涓氬簲鐢ㄤ互鍙婂彲縐繪鎬с傜劧鑰屾垜浠繀欏繪壙璁よ繖闂ㄨ璦鍜屽叾鐜版湁鐨勭被搴擄紝宸茬粡榪囦簡15騫寸殑鍙戝睍錛屽畠涓嶈兘鍐嶆彁渚涙洿濂界殑鍔熻兘鏉ヨВ鍐崇幇鍦ㄧ殑鍟嗕笟闂銆?nbsp; 闃呰鍏ㄦ枃 ]]> XSL鍏ラ棬(緲昏瘧) http://www.tkk7.com/kuuyee/archive/2011/03/09/345993.htmlkuuyee kuuyee Wed, 09 Mar 2011 00:58:00 GMT http://www.tkk7.com/kuuyee/archive/2011/03/09/345993.html http://www.tkk7.com/kuuyee/comments/345993.html http://www.tkk7.com/kuuyee/archive/2011/03/09/345993.html#Feedback 1 http://www.tkk7.com/kuuyee/comments/commentRss/345993.html http://www.tkk7.com/kuuyee/services/trackbacks/345993.html 鏈功涓嶉敊,鎵浠ョ炕璇戜簡涓涓媂SL鐨勫叆闂ㄩ儴鍒?
XSL鏄嬩竴鈥嬩釜鈥嬫ā鈥嬫澘鈥嬭鈥嬭█鈥嬶紝鑰屸嬩笉鈥嬫槸鈥嬩竴鈥嬩釜鈥嬬▼鈥嬪簭鈥嬭鈥嬭█鈥嬨傗嬭繖鈥嬫剰鈥嬪懗鈥嬬潃鈥媠tylesheet鍒垛嬪畾鈥嬩簡鈥嬩竴鈥嬩釜鈥嬭緭鈥嬪嚭鈥嬫牱鈥嬫湰鈥嬶紝鑰屸嬩笉鈥嬫槸鈥嬩嬌鈥嬬敤鈥嬬▼鈥嬪簭鈥嬫寜鈥嬫鈥嬮鈥嬬敓鈥嬫垚鈥嬨傗嬩竴鈥嬩釜鈥媠tylesheet鍖呪嬪惈鈥嬩簡鈥嬩竴鈥嬩釜鈥嬫販鈥嬪悎鈥嬬殑鈥嬭緭鈥嬪嚭鈥嬫牱鈥嬫湰鈥嬶紝騫垛嬩笖鈥嬩負鈥嬫瘡鈥嬩釜鈥嬫牱鈥嬫湰鈥嬩僵鈥嬫埓鈥嬩簡鈥嬭緭鈥嬪嚭鈥嬫寚鈥嬩護鈥嬨傗嬫瘡鈥嬩竴鈥嬩釜鈥嬫檽鈥嬪緱鈥嬭緭鈥嬪嚭鈥嬫牱鈥嬫湰鈥嬪姞鈥嬩笂鈥嬪鈥嬬悊鈥嬫寚鈥嬩護鈥嬪氨鈥嬫瀯鈥嬫垚鈥嬩簡鈥嬩竴鈥嬩釜鈥嬫ā鈥嬫澘鈥嬨傗? 闃呰鍏ㄦ枃 ]]> 瑁呰澆宓屽叆寮廕Boss鍒癟omat涓?/title> http://www.tkk7.com/kuuyee/archive/2011/03/08/345915.htmlkuuyee kuuyee Tue, 08 Mar 2011 01:19:00 GMT http://www.tkk7.com/kuuyee/archive/2011/03/08/345915.html http://www.tkk7.com/kuuyee/comments/345915.html http://www.tkk7.com/kuuyee/archive/2011/03/08/345915.html#Feedback 0 http://www.tkk7.com/kuuyee/comments/commentRss/345915.html http://www.tkk7.com/kuuyee/services/trackbacks/345915.html 闃呰鍏ㄦ枃 ]]> Jenkins鏂囨。緲昏瘧(1)-綆$悊 http://www.tkk7.com/kuuyee/archive/2011/03/07/345864.htmlkuuyee kuuyee Mon, 07 Mar 2011 02:54:00 GMT http://www.tkk7.com/kuuyee/archive/2011/03/07/345864.html http://www.tkk7.com/kuuyee/comments/345864.html http://www.tkk7.com/kuuyee/archive/2011/03/07/345864.html#Feedback 0 http://www.tkk7.com/kuuyee/comments/commentRss/345864.html http://www.tkk7.com/kuuyee/services/trackbacks/345864.html Jenkins闇鈥嬭鈥嬩竴鈥嬩簺鈥嬬鈥嬬洏鈥嬬┖鈥嬮棿鈥嬫潵鈥嬫墽鈥嬭鈥嬫瀯鈥嬪緩鈥嬪拰鈥嬪綊鈥嬫。鈥嬨傗嬩綘鈥嬪彲鈥嬩互鈥嬪湪鈥婮enkins鐨勨嬮厤鈥嬬疆鈥嬮〉鈥嬮潰鈥嬫煡鈥嬬湅鈥嬬鈥嬬洏鈥嬫墍鈥嬪湪鈥嬬殑鈥嬭礬鈥嬪緞鈥嬨傗嬮粯鈥嬭鈥嬫儏鈥嬪喌鈥嬩笅鈥嬫槸鈥媬/.jenkins錛屼綘鈥嬪彲鈥嬩互鈥嬮氣嬭繃鈥嬪鈥嬩笅鈥嬬殑鈥嬫柟鈥嬫硶鈥嬫潵鈥嬫敼鈥嬪彉鈥嬭鈥嬬疆鈥嬶細 闃呰鍏ㄦ枃 ]]> 榪滅▼璋冭瘯Tomcat7涓嬬殑搴旂敤 http://www.tkk7.com/kuuyee/archive/2010/12/03/339730.htmlkuuyee kuuyee Fri, 03 Dec 2010 09:46:00 GMT http://www.tkk7.com/kuuyee/archive/2010/12/03/339730.html http://www.tkk7.com/kuuyee/comments/339730.html http://www.tkk7.com/kuuyee/archive/2010/12/03/339730.html#Feedback 0 http://www.tkk7.com/kuuyee/comments/commentRss/339730.html http://www.tkk7.com/kuuyee/services/trackbacks/339730.html
榪滅▼璋冭瘯Tomcat7涓嬬殑搴旂敤
棣栧厛鍦═omcat鐨刡in鐩綍涓嬩慨鏀筩atalina.sh,鍔犲叆JAVA_OPTS鍙傛暟:
JPDA_ADDRESS=20777 JAVA_OPTS='-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=20777'
鍏朵腑JPDA_ADDRESS瑕佹寚瀹氫竴涓病鏈夎鍗犵敤鐨勭鍙?濡傛灉涓嶆寚瀹?榛樿鍊兼槸8000
鐒跺悗鐢ㄤ笅闈㈢殑鏂瑰紡鍚姩tomcat錛?/p>
鏈鍚庡惎鍔‥clipse錛岄夋嫨浣犳兂瑕丏ebug鐨勭被騫惰緗柇鐐癸紝鐒跺悗閫夋嫨Debug宸ュ叿鏍忎笅鐨凞ebug瀛愯彍鍗?Debug…)錛屽湪寮瑰嚭鐨凞ebug紿楀彛涓紝鍦ㄥ乏杈圭殑鑿滃崟欏逛腑閫夋嫨榪滅▼璋冭瘯(Remote Java Application)錛岀劧鍚庤緭鍏ユ満鍣ㄥ悕鍜岀鍙o紝姣斿璇?92.168.1.1鍜?0777錛岀劧鍚嶢pply騫朵笖寮濮婦ebug
2010-12-03
]]>JDK7 絎洓涓噷紼嬬鐗堟湰鏀懼嚭錛堣瘧錛?/title> http://www.tkk7.com/kuuyee/archive/2009/08/04/289693.htmlkuuyee kuuyee Mon, 03 Aug 2009 18:20:00 GMT http://www.tkk7.com/kuuyee/archive/2009/08/04/289693.html http://www.tkk7.com/kuuyee/comments/289693.html http://www.tkk7.com/kuuyee/archive/2009/08/04/289693.html#Feedback 2 http://www.tkk7.com/kuuyee/comments/commentRss/289693.html http://www.tkk7.com/kuuyee/services/trackbacks/289693.html
7鏈?0鍙稴un鏀懼嚭浜咼DK7鐨勭4涓噷紼嬬鐗堟湰JDK Milestone 4 錛孲un璁″垝鍦?010騫?鏈堟斁鍑虹8涓噷紼嬬鐗堟湰錛屽眾鏃朵篃鏄渶鍚庝竴涓噷紼嬬鐗堟湰錛屼篃灝辨槸璇存垜浠嚦灝戣鍦?010騫?鏈堝悗鎵嶈兘鐪嬪埌JDK7鐨勬渶緇堢増鏈紝鑰屼笖鍓嶆彁鏄疭un涓嶈煩紲ㄣ?br />
鏌ョ湅璇︾粏鐨凧DK閲岀▼紕戠増鏈鍒掕鐪媓ttp://openjdk.java.net/projects/jdk7/milestones/
榪欎釜閲岀▼紕戠増鏈坊鍔犱簡濡備笅鏂扮壒鎬э細
鍏煎JDK6u10鐨勬柊鐗規э細Java Plug-In 鎶鏈紙涓昏鏄拡瀵笰pplet鐨勶級錛?a >Java Kernel錛堢簿綆鐨凧RE錛変互鍙?a >Quick Starter(蹇熷惎鍔紝鎹鑳芥妸鍐呭瓨浣跨敤鎺у埗鍦?0MB鍐?
JSR 308錛?a >Annotations on Java types,瀵笿ava娉ㄨВ璇硶鐨勬墿灞曪紝浣挎敞瑙h兘澶熺敤鍦↗ava綾誨瀷涓婏紝濮嬭岃兘澶熸鏌ュ悇縐嶅悇鏍風殑緙栬瘧鏃墮敊璇紙compile-time
error checkers 錛夈?/li>
璁″垝鏇存柊鐨?a >XML stack騫舵病鏈夊嚭鐜板湪M4涓紝鎴戜滑鍙兘鏈熷緟M5鏉ュ厬鐜頒簡銆?br />
瀹屾暣鐨勬洿鏂板垪琛ㄨ鐪?a >榪欓噷 ]]> 鐢╩aven-jdocbook-plugin綆鍗曢厤緗甦ocbook5.0鐜 http://www.tkk7.com/kuuyee/archive/2009/07/27/288613.htmlkuuyee kuuyee Mon, 27 Jul 2009 09:24:00 GMT http://www.tkk7.com/kuuyee/archive/2009/07/27/288613.html http://www.tkk7.com/kuuyee/comments/288613.html http://www.tkk7.com/kuuyee/archive/2009/07/27/288613.html#Feedback 2 http://www.tkk7.com/kuuyee/comments/commentRss/288613.html http://www.tkk7.com/kuuyee/services/trackbacks/288613.html 鏂囩珷浠嬬粛5.0鐨勭紪璇戠幆澧?鐪熺殑姣旇緝綆鍗?涓嶈繃鎴戜粖澶╃湅浜嗙湅jboss seam鐨勬枃妗f瀯寤鴻繃紼?鏋勫緩鐜鎼緩鐪熸槸綆鍗曠殑涓嶈兘鍐嶇畝鍗曚簡,jboss seam浣跨敤maven鏉ュ彂甯僤ocbook鏂囨。,鐢ㄥ埌浜唌aven-jdocbook-plugin,鎴戞妸jboss seam鐨勬瀯寤烘彁鍙栧嚭鏉?澶у鍙互鍙傝冩潵鏂逛究鏋勫緩鑷繁鐨刣ocbook.
鍒涘緩涓涓渶鏈綆鍗曠殑maven絀洪」鐩?pom.xml鍐呭濡備笅:
<? xml version="1.0" ?>
< project xmlns ="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
< modelVersion > 4.0.0 </ modelVersion >
< groupId > org.kuuyee </ groupId >
< artifactId > first-docbook </ artifactId >
< packaging > jar </ packaging >
< version > 1.0-SNAPSHOT </ version >
< name > first-docbook </ name >
< build >
< plugins >
<!-- the docbook generation plugin for the user guide -->
< plugin >
< groupId > org.jboss.maven.plugins </ groupId >
< artifactId > maven-jdocbook-plugin </ artifactId >
< version > 2.1.1 </ version >
< extensions > true </ extensions >
< dependencies >
< dependency >
< groupId > org.jboss </ groupId >
< artifactId > jbossorg-docbook-xslt </ artifactId >
< version > 1.1.0 </ version >
</ dependency >
< dependency >
< groupId > org.jboss </ groupId >
< artifactId > jbossorg-jdocbook-style </ artifactId >
< version > 1.1.0 </ version >
< type > jdocbook-style </ type >
</ dependency >
</ dependencies >
< executions >
< execution >
< id > tutorial_zh_CN </ id >
< phase > package </ phase >
< goals >
< goal > resources </ goal >
< goal > generate </ goal >
</ goals >
< configuration >
< sourceDocumentName > master.xml </ sourceDocumentName >
< sourceDirectory > ${basedir}/src/main/docbook/zh_CN </ sourceDirectory >
< imageResource >
< directory > ${basedir}/src/main/docbook/images </ directory >
</ imageResource >
< cssResource >
< directory > ${basedir}/src/main/docbook/css </ directory >
</ cssResource >
< targetDirectory > ${basedir}/target/docbook/zh_CN </ targetDirectory >
< formats >
< format >
< formatName > pdf </ formatName >
< stylesheetResource > classpath:/xslt/org/jboss/pdf.xsl </ stylesheetResource >
< finalName > zh_CN.pdf </ finalName >
</ format >
< format >
< formatName > html </ formatName >
< stylesheetResource > classpath:/xslt/org/jboss/xhtml.xsl </ stylesheetResource >
< finalName > index.html </ finalName >
</ format >
< format >
< formatName > html_single </ formatName >
< stylesheetResource > classpath:/xslt/org/jboss/xhtml-single.xsl </ stylesheetResource >
< finalName > index.html </ finalName >
</ format >
</ formats >
< options >
< xincludeSupported > true </ xincludeSupported >
</ options >
</ configuration >
</ execution >
</ executions >
</ plugin >
</ plugins >
</ build >
<!-- basic JBoss repository so that the common parent POM in jbosscache-support can be found -->
< repositories >
< repository >
< id > snapshots.jboss.org </ id >
< url > http://snapshots.jboss.org/maven2 </ url >
</ repository >
< repository >
< id > repository.jboss.org </ id >
< url > http://repository.jboss.org/maven2 </ url >
</ repository >
</ repositories >
</ project >
鍦╯rc/main/docbook/zh_CN涓嬫柊寤轟袱涓獂ml鏂囦歡master.xml,chap1.xml.榪欓噷鐢ㄥ埌浜哾ocbook鐨勭墿鐞嗗垎鍓叉蹇?灝辨槸鎶婂崟涓枃妗f媶鍒嗘枃妗d負澶氫釜鏂囦歡,榪欏湪鏂囨。姣旇緝宸ㄥぇ鐨勬椂鍊欏緢瀹炵敤.
master.xml鏄枃妗d富鏂囦歡,鍐呭濡備笅:
<? xml version='1.0' encoding="utf-8" ?>
< book xmlns ="http://docbook.org/ns/docbook" version ="5.0" xml:lang ="zh-CN" xmlns:xlink ="http://www.w3.org/1999/xlink" xmlns:xi ="http://www.w3.org/2001/XInclude" >
< title > 鍏夊瓙鐨勭涓鏈珼ocbook涔?/span></ title >
< xi:include href ="chap1.xml" />
</ book >
chap1.xml鏄枃妗g殑絎竴绔?鍐呭濡備笅:
<? xml version='1.0' encoding="utf-8" ?>
< chapter xmlns ="http://docbook.org/ns/docbook" version ="5.0" xml:lang ="zh-CN"
xmlns:xlink="http://www.w3.org/1999/xlink" id ="ch1" xmlns:xi ="http://www.w3.org/2001/XInclude" >
< title > 鍏夊瓙鐨勭涓綃嘍ocbook 5.0鏂囨。 </ title >
< section >
< title > 絎竴绔犳爣棰?/span></ title >
< para >
榪欐槸鍏夊瓙鐨勭涓綃嘍ocbook 5.0鏂囨。錛屾垜鐨凚LOG< link xlink:href ='http://www.tkk7.com/kuuyee/'>鍏夊瓙CI涔嬫梾</link>銆?br />
</para >
</ section >
</ chapter >
ok,鎴戜滑鍙互鍙戝竷鏂囨。浜?娌¢敊!灝辨槸榪欎箞綆鍗?鍦ㄩ」鐩牴鐩綍榪愯鍛戒護
mvn clean package
濡傛灉澶у涓嶆槑鐧藉彲浠ヤ笅杞介檮浠舵簮鐮佺湅鐪?鏍峰紡榪樻槸浣跨敤jboss鐨?涓嶈繃鍙互鑷繁淇敼xsl!
鏍蜂緥浠g爜
璐村紶鍥劇湅鐪嬬敓鎴愮殑鏂囨。,鍛靛懙!
]]> maven-tomcat-plugin璇曠敤 http://www.tkk7.com/kuuyee/archive/2009/07/21/287639.htmlkuuyee kuuyee Tue, 21 Jul 2009 06:13:00 GMT http://www.tkk7.com/kuuyee/archive/2009/07/21/287639.html http://www.tkk7.com/kuuyee/comments/287639.html http://www.tkk7.com/kuuyee/archive/2009/07/21/287639.html#Feedback 0 http://www.tkk7.com/kuuyee/comments/commentRss/287639.html http://www.tkk7.com/kuuyee/services/trackbacks/287639.html
< properties >
<!-- Cargo settings -->
< cargo .container.manager.url > http://192.168.1.107/manager </ cargo.container.manager.url >
< cargo .container.username > admin </ cargo.container.username >
< cargo .container.password > 123456 </ cargo.container.password >
< cargo .wait > false </ cargo.wait >
</ properties >
< build >
< plugins >
< plugin >
< groupId > org.codehaus.mojo </ groupId >
< artifactId > tomcat-maven-plugin </ artifactId >
< version > 1.0-beta-1 </ version >
< configuration >
< path > /runes </ path >
< url > ${cargo.container.manager.url} </ url >
< username > ${cargo.container.username} </ username >
< password > ${cargo.container.password} </ password >
< warDirectory > ${basedir}/src/main/webapp </ warDirectory >
</ configuration >
< executions >
< execution >
< id >tomcat- deploy </ id >
< phase >deploy </ phase >
< goals >
< goal > deploy </ goal >
</ goals >
</ execution >
<!-- execution>
<id>undeploy</id>
<phase>deploy</phase>
<goals>
<goal>start</goal>
</goals>
</execution -->
</ executions >
</ plugin >
</ plugins >
</ build >
maven-tomcat-plugin閫氳繃tomcat鐨刴anager鎺у埗鍙版潵deploy鎴杣ndeploy搴旂敤,鎵浠ヨ鎶婁綘鐨則omcat鐨勭浉鍏充俊鎭厤緗笂,鍖呮嫭manager url,鐢ㄦ埛鍚嶅強瀵嗙爜絳? ]]>
主站蜘蛛池模板:
国产99久久久国产精免费 |
亚洲欧洲国产综合AV无码久久 |
亚洲视频在线观看免费 |
亚洲经典在线中文字幕 |
亚洲色精品三区二区一区 |
国产成人高清亚洲一区91 |
伊人免费在线观看高清版 |
3d成人免费动漫在线观看 |
青青草国产免费久久久91 |
国产亚洲情侣一区二区无 |
久久久亚洲AV波多野结衣 |
亚洲最大的黄色网 |
一进一出60分钟免费视频 |
久草视频在线免费看 |
国产成人A在线观看视频免费 |
免费jjzz在在线播放国产 |
亚洲国产精品无码久久一线 |
亚洲人成影院77777 |
无码的免费不卡毛片视频 |
四虎国产成人永久精品免费 |
好男人看视频免费2019中文 |
亚洲人成亚洲人成在线观看
|
亚洲精品国产自在久久 |
亚洲一二成人精品区 |
亚洲国产成人久久精品大牛影视
|
亚洲国产成人久久综合区 |
亚洲国产成人久久综合碰碰动漫3d |
亚洲中文字幕乱码熟女在线 |
一出一进一爽一粗一大视频免费的 |
亚洲高清免费在线观看 |
亚洲国产黄在线观看 |
亚洲精品中文字幕麻豆 |
尤物视频在线免费观看 |
在线观看永久免费 |
亚洲AⅤ视频一区二区三区 |
亚洲精品美女视频 |
91av免费在线视频 |
夜夜爽免费888视频 |
亚洲AV日韩精品久久久久久久 |
国产亚洲午夜精品 |
亚洲视频免费在线播放 |