Ò»¡¢Ê²Ã´ÊÇ·´É䣺
·´ÉäµÄ¸ÅÄîÊÇÓÉSmithÔÚ1982ÄêÊ×´ÎÌá³öµÄ£¬Ö÷ÒªÊÇÖ¸³ÌÐò¿ÉÒÔ·ÃÎÊ¡¢¼ì²âºÍÐÞ¸ÄËü±¾Éí״̬»òÐÐΪµÄÒ»ÖÖÄÜÁ¦¡£ÕâÒ»¸ÅÄîµÄÌá³öºÜ¿ìÒý·¢Á˼ÆËã»ú¿ÆѧÁìÓò¹ØÓÚÓ¦Ó÷´ÉäÐÔµÄÑо¿¡£ËüÊ×Ïȱ»³ÌÐòÓïÑÔµÄÉè¼ÆÁìÓòËù²ÉÓÃ,²¢ÔÚLispºÍÃæÏò¶ÔÏó·½ÃæÈ¡µÃÁ˳ɼ¨¡£ÆäÖÐLEAD/LEAD++ ¡¢OpenC++ ¡¢MetaXaºÍOpenJavaµÈ¾ÍÊÇ»ùÓÚ·´Éä»úÖƵÄÓïÑÔ¡£×î½ü£¬·´Éä»úÖÆÒ²±»Ó¦Óõ½ÁËÊÓ´°ÏµÍ³¡¢²Ù×÷ϵͳºÍÎļþϵͳÖС£
·´Éä±¾Éí²¢²»ÊÇÒ»¸öиÅÄ¾¡¹Ü¼ÆËã»ú¿Æѧ¸³ÓèÁË·´Éä¸ÅÄîеĺ¬Òå¡£ÔÚ¼ÆËã»ú¿ÆѧÁìÓò£¬·´ÉäÊÇÖ¸Ò»ÀàÓ¦Óã¬ËüÃÇÄܹ»×ÔÃèÊöºÍ×Ô¿ØÖÆ¡£Ò²¾ÍÊÇ˵£¬ÕâÀàÓ¦ÓÃͨ¹ý²ÉÓÃijÖÖ»úÖÆÀ´ÊµÏÖ¶Ô×Ô¼ºÐÐΪµÄÃèÊö£¨self-representation£©ºÍ¼à²â£¨examination£©£¬²¢Äܸù¾Ý×ÔÉíÐÐΪµÄ״̬ºÍ½á¹û£¬µ÷Õû»òÐÞ¸ÄÓ¦ÓÃËùÃèÊöÐÐΪµÄ״̬ºÍÏà¹ØµÄÓïÒå¡£
¶þ¡¢Ê²Ã´ÊÇJavaÖеÄÀà·´É䣺
Reflection ÊÇ Java ³ÌÐò¿ª·¢ÓïÑÔµÄÌØÕ÷Ö®Ò»£¬ËüÔÊÐíÔËÐÐÖÐµÄ Java ³ÌÐò¶Ô×ÔÉí½øÐмì²é£¬»òÕß˵“×ÔÉ󔣬²¢ÄÜÖ±½Ó²Ù×÷³ÌÐòµÄÄÚ²¿ÊôÐԺͷ½·¨¡£Java µÄÕâÒ»ÄÜÁ¦ÔÚʵ¼ÊÓ¦ÓÃÖÐÓõò»ÊǺܶ࣬µ«ÊÇÔÚÆäË ......
Java ·´ÉäÊÇJavaÓïÑÔµÄÒ»¸öºÜÖØÒªµÄÌØÕ÷£¬ËüʹµÃJava¾ßÌåÁË“¶¯Ì¬ÐÔ”¡£
ÔÚJavaÔËÐÐʱ»·¾³ÖУ¬¶ÔÓÚÈÎÒâÒ»¸öÀ࣬ÄÜ·ñÖªµÀÕâ¸öÀàÓÐÄÄЩÊôÐԺͷ½·¨£¿¶ÔÓÚÈÎÒâÒ»¸ö¶ÔÏó£¬ÄÜ·ñµ÷ÓÃËüµÄÈÎÒâÒ»¸ö·½·¨£¿´ð°¸Êǿ϶¨µÄ¡£ÕâÖÖ¶¯Ì¬»ñÈ¡ÀàµÄÐÅÏ¢ÒÔ¼°¶¯Ì¬µ÷ÓöÔÏóµÄ·½·¨µÄ¹¦ÄÜÀ´×ÔÓÚJava ÓïÑԵķ´É䣨Reflection£©»úÖÆ¡£
Java ·´Éä»úÖÆÖ÷ÒªÌṩÁËÒÔϹ¦ÄÜ£º
ÔÚÔËÐÐʱÅжÏÈÎÒâÒ»¸ö¶ÔÏóËùÊôµÄÀà¡£
ÔÚÔËÐÐʱ¹¹ÔìÈÎÒâÒ»¸öÀàµÄ¶ÔÏó¡£
ÔÚÔËÐÐʱÅжÏÈÎÒâÒ»¸öÀàËù¾ßÓеijÉÔ±±äÁ¿ºÍ·½·¨¡£
ÔÚÔËÐÐʱµ÷ÓÃÈÎÒâÒ»¸ö¶ÔÏóµÄ·½·¨¡£
Reflection ÊÇJava±»ÊÓΪ¶¯Ì¬£¨»ò×¼¶¯Ì¬£©ÓïÑÔµÄÒ»¸ö¹Ø¼üÐÔÖÊ¡£Õâ¸ö»úÖÆÔÊÐí³ÌÐòÔÚÔËÐÐʱ͸¹ýReflection APIsÈ¡µÃÈκÎÒ»¸öÒÑÖªÃû³ÆµÄclassµÄÄÚ²¿ÐÅÏ¢£¬°üÀ¨Æämodifiers£¨ÖîÈçpublic, static µÈµÈ£©¡¢superclass£¨ÀýÈçObject£©¡¢ÊµÏÖÖ®interfaces£¨ÀýÈçSerializable£©£¬Ò²°üÀ¨fieldsºÍmethods µÄËùÓÐÐÅÏ¢£¬²¢¿ÉÓÚÔËÐÐʱ¸Ä±äfieldsÄÚÈÝ»òµ÷ÓÃmethods¡£
Ò»°ã¶øÑÔ£¬¿ª·¢ÕßÉçȺ˵µ½¶¯Ì¬ÓïÑÔ£¬´óÖÂÈÏͬµÄÒ»¸ö¶¨ÒåÊÇ£º“³ÌÐòÔËÐÐʱ£¬ÔÊÐí¸Ä±ä³ÌÐò½á¹¹»ò±äÁ¿ÀàÐÍ£¬ÕâÖÖÓïÑÔ³ÆΪ¶¯Ì¬ÓïÑÔ”¡£´ÓÕâ¸ö¹Ûµã¿´£¬Perl£¬Python£¬R ......
1. ÔÚJavaÖУ¬Ò»¸öÀàÖ»Äܹ»ÓÐÒ»¸öÖ±½ÓµÄ¸¸À࣬µ«ÊÇÒ»¸öÀà¿ÉÒÔʵÏÖ¶à¸ö½Ó¿Ú£¬Java²ÉÓÃÕâÖÖ·½Ê½ÊµÏÖ¶à¼Ì³Ð£»
2. ½Ó¿ÚµÄ¸ÅÄ
a.½Ó¿ÚÃ÷È·µØÃèÊöÁËϵͳ¶ÔÍâÌṩµÄËùÓзþÎñ£¬ÇåÎúµØ°ÑϵͳµÄʵÏÖϸ½ÚÓë½Ó¿Ú·ÖÀ룬ϵͳµÄʵÏÖϸ½ÚÓɽӿڵÄʵÏÖÀฺÔðʵÏÖ£¬½Ó¿Ú¸ºÔð¶ÔÍâÃèÊöϵͳÌṩµÄ·þÎñ£¬¶ÔÄÚÃèÊöϵͳӦ¸Ã¾ß±¸µÄ¹¦ÄÜ£»
b.½Ó¿ÚºÍ³éÏóÀ඼²»Äܹ»±»ÊµÀý»¯£¬µ«ÊdzéÏóÀàÖпÉÒÔ°üº¬¾ßÌåµÄʵÏÖ£¬ÕâÑù¿ÉÒÔÌá¸ß´úÂëµÄÖØÓÃÐÔ£¬¶ø½Ó¿Ú²»ÄÜ°üº¬ÈκξßÌåµÄʵÏÖ£»
3.½Ó¿ÚµÄÌصã
£¨1£©½Ó¿ÚÖеijÉÔ±±äÁ¿±ØÐëÈ«²¿ÊÇpublic,static,finalÀàÐÍ£¨±àÒëʱ³£Á¿£©£¬±ØÐë±»ÏÔʽµØ³õʼ»¯£»
£¨2£©½Ó¿ÚÖеķ½·¨±ØÐëÈ«²¿ÊÇpublic,abstractÀàÐÍ£»
×ۺϣ¨1£©£¨2£©Á½µã£¬½Ó¿ÚÖв»Äܹ»³öÏÖ£º
A.ʵÀý±äÁ¿
B ......
ʹÓÃDOM·½Ê½£¬Java½âÎöXML»ù±¾²½Öè:
Ê×ÏÈ£¬ÎÒÃÇÐèÒª½¨Á¢Ò»¸ö½âÎöÆ÷¹¤³§¡£
DocumentBuilderFactory dbf=DocumentBuilderFactory.newInstance();
È»ºó¿ÉÒÔÀûÓÃÕâ¸ö¹¤³§À´»ñµÃÒ»¸ö¾ßÌåµÄ½âÎö¶ÔÏó¡£
DocumentBuilder builder=dbf.newDocumentBuilder();
DocumentBuilderµÄParse()·½·¨½ÓÊÜÒ»¸öXMLÎĵµÃû×÷ΪÊäÈë²ÎÊý£¬·µ»ØÒ»¸öDocument¶ÔÏó¡£Document¶ÔÏó´ú±íÁË Ò»¸öXMLÎĵµµÄÊ÷Ä£ÐÍ¡£
Document doc=builder.parse("candiate.xml");
ʹÓÃDocument¶ÔÏóµÄgetElementsByTagName()·½·¨£¬ÎÒÃÇ¿ÉÒԵõ½Ò»¸öNodeList¶ÔÏó£¬ËûÊÇXMLÎĵµÖеıêÇ©ÔªËØ ÁÐ±í£¬¿ÉÒÔʹÓÃNodeList¶ÔÏóµÄitem()·½·¨À´µÃÁбíÖеÄÿһ¸öNode¶ÔÏó¡£
NodeList nl=doc.getElementsByTagName("PERSON");
Element node=(Element)nl.item(i);
×îºó£¬ÎÒÃÇ»áʹÓÃNode¶ÔÏóµÄgetNodeValue()·½·¨Ìáȡij¸ö±êÇ©ÄÚµÄÄÚÈÝ¡£
node.getElementsByTagName("NAME").item(0).getFirstChild().getNodeValue()
ÍêÕû³ÌÐò´úÂë:
import javax.xml.parsers.*;
import org.w3c.dom.*;
public class dom {
public static void main(String args[]){
String uri=args[0];
try{
DocumentBuilderFactory factory = DocumentBuilde ......
package com.gamvan.tools;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.StringTokenizer;
public class FileOperate {
private String message;
public FileOperate() {
}
/**
* ¶ÁÈ¡Îı¾ÎļþÄÚÈÝ
* @param filePathAndName ´øÓÐÍêÕû¾ø¶Ô·¾¶µÄÎļþÃû
* @param encoding Îı¾Îļþ´ò¿ªµÄ±àÂ뷽ʽ
* @return ·µ»ØÎı¾ÎļþµÄÄÚÈÝ
*/
public String&nbs ......
package com.jcauto.action;
import java.util.ArrayList;
import java.util.List;
public class ContentRsp {
private String resultCode;
List<ContentInfo> contentList = new ArrayList<ContentInfo>();
public void addContent(ContentInfo contentInfo) {
contentList.add(contentInfo);
}
public void removeContent(ContentInfo contentInfo) {
contentList.remove(contentInfo);
}
public String getResultCode() {
return resultCode;
}
public void setResultCode(String resultCode) {
this.resultCode = resultCode;
}
}
package com.jcauto.action;
public class ContentInfo {
private String contentName;
private String contentId;
private String dispritiong;
private String catalogId;
private String title;
public String getContentName() {
return contentName;
}
public void setContentName(String contentName) {
this.contentName = contentName;
}
public String getContentId() {
return contentId;
}
public void setContentId(String con ......
package com.jcauto.action;
import java.util.ArrayList;
import java.util.List;
public class ContentRsp {
private String resultCode;
List<ContentInfo> contentList = new ArrayList<ContentInfo>();
public void addContent(ContentInfo contentInfo) {
contentList.add(contentInfo);
}
public void removeContent(ContentInfo contentInfo) {
contentList.remove(contentInfo);
}
public String getResultCode() {
return resultCode;
}
public void setResultCode(String resultCode) {
this.resultCode = resultCode;
}
}
package com.jcauto.action;
public class ContentInfo {
private String contentName;
private String contentId;
private String dispritiong;
private String catalogId;
private String title;
public String getContentName() {
return contentName;
}
public void setContentName(String contentName) {
this.contentName = contentName;
}
public String getContentId() {
return contentId;
}
public void setContentId(String con ......
×ܼǼÊý:6386; ×ÜÒ³Êý:1065; ÿҳ6 Ìõ;
Ê×Ò³ ÉÏÒ»Ò³ 1
[2] [3] [4] [5] [6] [7] [8] [9] [10] ÏÂÒ»Ò³ βҳ