Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

Lombok Ïû³ýJavaµÄÈß³¤


  LombokÊÇÒ»¸ö¿ªÔ´ÏîÄ¿£¬¿ÉÒÔÓÃÀ´Ïû³ýJava´úÂëµÄÈß³¤
  Ïêϸ½éÉܲο´http://www.ibm.com/developerworks/opensource/library/os-lombok/index.html
  ÏÂÃæ½éÉÜLombokÈçºÎÏû³ýJava´úÂëµÄÈß³¤¡£
1.      Ê×ÏÈÈ¥http://projectlombok.org/. ÏÂÔØlombok.jar °ü
2.      Èç¹ûÊÇwindows²Ù×÷ϵͳ£¬¿ÉÒÔÖ±½ÓË«»÷ Lombok.jar ÎļþʹÓôò¿ª½øÐа²×°£¬
Ñ¡ÔñÄã×¼±¸°²×°µÄeclipse°æ±¾¡££¨ÔÚÕâÀï°²×°Ö÷ÒªÊÇΪÁËʹÓÃeclipse±à¼­javaÎļþʱ·½±ã²é¿´£©¡£
3.      °²×°Íê³Éºó£¬´ò¿ªeclipse´´½¨Ò»¸öjava¹¤³Ì£¬È»ºó¿ªÊ¼½øÐÐjava´úÂë±àд
ͨ¹ýÉÏÃæµÄ´úÂë´ó¼ÒÊDz»ÊÇ·¢ÏÖÁËJavaBeanÉÙÁ˺ܶà´úÂ룬ֻҪÔÚclassÇ°Ôö¼Ó @Data ¾Í»áÖ±½Ó½«ÀïÃæµÄ˽ÓÐ×Ö¶Î×Ö¶ÎÉú²úget£¬set·½·¨ºÍtoString£¨£©£¬equals£¨£©£¬hashCode£¨£©·½·¨¡£
£¨°²×°¹ýlombokÖ®ºóÔÚ outlineÖпÉÒÔ¿´¼û£©
4.      Èç¹ûһЩget»òÕßset·½·¨²»Ï빫¿ª
ÔÚnameÊôÐÔÇ°Ôö¼Ó@Getter£¨AccessLevel.PROTECTED£©×¢½â£¬getName()µÄ·ÃÎÊȨÏÞ·¢Éú±ä»¯¡£
5.      LombokÌṩµÄtoString() ·½·¨»áÁгöÀàÃûÒÔ¼°ËùÓеÄÊôÐÔÃûºÍÖµ£¬ÖмäÒÔ¶ººÅ·Ö¸î£»Èç¹ûÏëºöÂÔij¸öÊôÐÔ
ÔÚÀàÉÏÃæÔö¼Ó×¢½â@ToString(exclude=”name”) ÕâÑùnameÊôÐԾͲ»»áÊä³ö
6.      ÐÞ¸ÄhashCode£¬equals·½·¨
ÔÚÀàÉÏÃæÔö¼Ó@EqualsAndHashCode(exclude="name")
7.      Ïû³ýry/catch/finally ´úÂë¿é
ÔÚInputStream Ç°Ôö¼Ó@clearup ×¢½â£»Ïû³ýÁË try/catch/finally ¿é£¬²¢ÇҹرÕÁË¿ª·ÅÁ÷¡£
 
×ܽ᣺ Lombok ÈÃÎÒÃǵĴúÂë¿´ÆðÀ´Õû½àÁ˺ܶ࣬¼õÉÙÁËÈßÓ࣬ÓÐÀûÓÚºóÆÚµÄά»¤¡£


Ïà¹ØÎĵµ£º

C#ºÍJavaµÄ±Õ°ü£­Jon̸¡¶The Beauty of Closures¡·


Ô­ÎÄ£ºhttp://csharpindepth.com/Articles/Chapter5/Closures.aspx
µÚÒ»¶ÎÂÔ¡£¡£¡£
´ó¶àÊý½²±Õ°üµÄÎÄÕ¶¼ÊÇ˵º¯ÊýʽÓïÑÔ£¬ÒòΪËüÃÇÍùÍù¶Ô±Õ°üµÄÖ§³Ö×îÍêÉÆ¡£µ±ÄãÔÚʹÓú¯ÊýʽÓïÑÔʱ£¬ºÜ¿ÉÄÜÒѾ­Çå³þÁ˽âÁËʲôÊDZհü£¬ËùÒÔÎÒÏëдһƪÔÚ¾­µäOOÓïÑÔ³öÏֵıհüÓÐʲôÓô¦Ó¦¸ÃÒ²ÊǺܺÏÊʵÄÊÂÇé¡£ÕâƪÎÄÕÂÎÒ×¼±¸½²Ò»ÏÂC#£¨1¡ ......

JavaÕýÔò±í´ïʽ

package com.sy.grasp;
import java.io.IOException;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class RegularExpression {
 /**
  * @param args
  * @throws IOException
  */
 public static void main(String[] args) throws IOException {
  ......

JavaÕýÔò±í´ïʽһ

¹Ø¼ü×Ö: java regex, regular expression
ÕýÔò±í´ïʽÔÚ´¦ÀíÎı¾·½ÃæÓô¦·Ç³£´ó£¬×îÔçÏñÔÚPerlºÍawkÓïÑÔÖУ¬ÌṩÁËÕâÖÖ»úÖÆ£¬JavaÔÚJava 2ÖÐÒ²Ôö¼ÓÁËÕýÔò±í´ïʽÕâ¸ö°üjava.util.regex¡£Õâ¸ö°üΪÓû§Ê¹ÓÃÕýÔò±í´ïʽ£¬ÌṩÁËÒ×ÓöøÈ«ÃæµÄÖ§³Ö¡£ÎÒµÄÑо¿·½ÏòÊÇwebÍÚ¾ò¡£´ÓÍøÒ³ÖÐÌáÈ¡ÄÚÈÝ,´¦ÀíÎı¾£¬µ±È»ÐèÒªÕýÔò±í´ïʽÕâ¸öÇ¿´ ......

ÓÃJavaʵÏÖÎļþ·Ö¸î\ºÏ²¢²Ù×÷

import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.sql.Timestamp;
import java.util.Arrays;
public class SmallToBig {
 private String newFileName;// ÐÂÎļþÃû×Ö
 private String filterName;// ¹ýÂ˹æÔòÃû×Ö
  ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ