Java Annotation×¢ÊÍÓï·¨
Java Annotation×¢ÊÍÓï·¨£¨Ò»£©
¹Ø¼ü×Ö: java annotation×¢ÊÍ
JAVA´ÓJ2SE5¿ªÊ¼ÌṩÃûΪannotation£¨×¢ÊÍ£¬±ê×¢£©µÄ¹¦ÄÜ¡£JavaµÄannotation£¬¿ÉÒÔ¸½¼ÓÔÚpackage, class, method, fieldµÈÉÏÃæ£¬Ï൱ÓÚ¸øËüÃÇÌí¼ÓÁ˶îÍâµÄ¸¨ÖúÐÅÏ¢¡£¸½¼ÓÔÚpackage, class, method, fieldµÈÉϵÄAnnotation£¬Èç¹ûûÓÐÍⲿ½âÎö¹¤¾ßµÈ¶ÔÆä¼ÓÒÔ½âÎöºÍ´¦ÀíµÄÇé¿ö£¬±¾Éí²»»á¶ÔJavaµÄÔ´´úÂë»òclassµÈ²úÉúÈκÎÓ°Ï죬Ҳ²»»á¶ÔËüÃǵÄÖ´ÐвúÉúÈκÎÓ°Ïì¡£
µ«½èÖúÍⲿ¹¤¾ß£¬±ÈÈçjavac£¬EJBÈÝÆ÷µÈ£¬¿ÉÒÔ¶Ô¸½¼ÓÔÚpackage, class, method, fieldµÄannotation½øÐнâÎö£¬¿ÉÒÔ¸ù¾Ýannotation¶ø×ö³öÏàÓ¦µÄ´¦Àí£¬±ÈÈçÔËÐÐʱ¸Ä±ä¶ÔÏó/·½·¨µÄÐÐΪ¡£
Java±ê×¼Annotation
@Deprecated Ï൱ÓÚJavadocµÄ@deprecated£¬±»@Deprecated±ê×¢µÄ¶ÔÏóclass, methodµÈ±»×¢Ã÷Ϊ²»ÍƼöʹÓá£Ö÷ÒªÓÃÓÚjavacµÈ±àÒ빤¾ß¡£
@Override ×¢Ã÷¶ÔÏómethodÖØÔØÁ˸¸ÀàµÄ·½·¨¡£javacµÈ±àÒ빤¾ß±àÒëʱ»á¸ù¾Ý´ËAnnotationÅжÏÖØÔØ·½·¨ÊÇ·ñÕýÈ·¡£
@SuppressWarnings ¸æËßjavacµÈ±àÒëÆ÷ºöÂÔËùÖ¸¶¨µÄÌØ¶¨µÄ¾¯¸æÐÅÏ¢¡£
@Target ±»¶¨ÒåµÄannotation¿ÉÒÔ¸½¼ÓÔÚÄÇЩ¶ÔÏóÉÏ¡£
@Retention annotationµÄ×÷ÓÃÆÚ¼ä¡£
Java±ê×¼AnnotationµÄʹÓÃ
@Deprecated£º
@Deprecated
public class TestBean {
…
}
@SuppressWarnings
@SuppressWarnings("serial")
public class TestBean implements java.io.Serializable {
…
}
@SuppressWarnings(value = {"serial", "unchecked"})
public String doSth() {
…
}
@Override
@Override
public String doSth() {
…
}
AnnotationµÄ¶¨Òå
¶¨Òå·½·¨£º
@interface AnnotationÃû {¶¨ÒåÌå}
¶¨ÒåÀý1£º
public @interface MyAnnotation {}
¸ÃÀý¶¨ÒåÁËÒ»¸öÎÞÈκÎÊôÐÔ/·½·¨µÄAnnotation¡£
¶¨ÒåÀý2£º
public @interface MyAnnotation {
public String value();
}
¸ÃÀý¶¨ÒåÁËÖ»ÓÐÒ»¸ö·½·¨Îªvalue()µÄAnnotation¡£Ò»°ãÀ´Ëµ£¬Ö»ÓÐÒ»¸ö·½·¨µÄAnnotation£¬·½·¨ÃûÒ»¶¨¶¨ÒåΪvalue¡£
¶¨ÒåÀý3£º
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.METHOD)
public @interface MyAnnotation {
public String value();
public String [] multiValues();
 
Ïà¹ØÎĵµ£º
send mail use smtp .u can send text or html, send to many peoples if u have a email user and pwd and the smtp of the email which u use.
package org.lc.smtp;
import java.io.IOException;
import java.util.Properties;
import javax.activation.DataHandler;
import javax.mail.Message;
import javax.mai ......
JavaÎÊÌâ¾µä32ÎÊ
µÚÒ»£¬Ì¸Ì¸final£¬ finally£¬ finalizeµÄÇø±ð¡£
µÚ¶þ£¬Anonymous Inner Class £¨ÄäÃûÄÚ²¿Àࣩ ÊÇ·ñ¿ÉÒÔextends£¨¼Ì³Ð£©ÆäËüÀ࣬ÊÇ·ñ¿ÉÒÔimplements£¨ÊµÏÖ£©interface£¨½Ó¿Ú£©£¿
µÚÈý£¬Static Nested Class ºÍ Inner ClassµÄ²»Í¬£¬ËµµÃÔ½¶àÔ½ºÃ£¨ÃæÊÔÌâÓе ......
ÓõÄÊÇMySQLÊý¾Ý¿â¡£
1£¬½¨Ò»¸öuserdb¿â£¬ÔÙ½¨userinfo±í£¬×ֶΣºid(int),username(varchar),password(varchar)¡£
create database userdb;
use userdb;
create table userinfo(
id int(10) not null auto_increment,
username varchar(20),
password varchar(20),
primary key(id));
2£¬DBConnection.jav ......
19.2 ·ÃÎÊÔ¶³ÌJava¶ÔÏóΪÁËʵÏÖ¶ÔÔ¶³ÌJava¶ÔÏóµÄ·ÃÎÊ£¬ÔÚ·þÎñÆ÷¶Ë£¬ÐèÒªÍê³ÉÈçϼ¸¸ö²½Ö裺 1. ´´½¨LiveCycle Data Service WebÓ¦Óã» 2. ʵÏÖPOJO JavaÀࣻ 3. ÔÚLiveCycle Data Service WebÓ¦ÓÃÖв¿ÊðPOJO JavaÀࣻ 4. ÅäÖÃremote-config.xmlÎļþ£¬ÉùÃ÷desination½Úµã£¬Ö¸ÏòPOJO JavaÀà¡£ ÔÚ¿Í»§¶ËÓ¦ÓÃÖУ¬ÐèҪʵÏÖ£º 1. ......
°²×°»·¾³£º
1.ÉÏ´«jdk-6u17-linux-i586.binºÍapache-tomcat-6.0.20.tar.gzµ½/usr
2.°²×°JDK
¡¡¡¡$chmod a+x jdk-6u17-linux-i586.bin
¡¡¡¡$ ./jdk-6u17-linux-i586.bin
¡¡¡¡$ vi /etc/profile
¡¡¡¡#Ìí¼ÓÈçÏÂ
¡¡¡¡export JAVA_HOME=/usr/jdk1.6.0_17
¡¡¡¡export PATH=$JAVA_HOME/bin:$PATH
¡¡¡¡$echo $JAVA_H ......