Bean和Bean之間也可以利用繼承(Inheritance)的方式。
HelloWorld.java

package com.example ;

public class HelloWorld {
private String message ;
private String message1 ;
public void getMessage(){
System.out.println("Your Message : " + message) ;
}
public void setMessage(String message) {
this.message = message;
}
public void getMessage1(){
System.out.println("Your Message1 : " + message1) ;
}
public void setMessage1(String message1) {
this.message1 = message1;
}
}

Codeless 發表在 痞客邦 留言(0) 人氣()

BeanPostProcessor可以針對初始化前後做一些修正(如:初始化前顯示為小寫,修正後為大寫等)
HelloWorld.java

package com.example ;

public class HelloWorld {
private String message ;
public void init(){
System.out.println("Initialization now") ;
}
public void getMessage(){
System.out.println("Your Message : " + message);
}
public void setMessage(String message) {
this.message = message;
}
public void destroy(){
System.out.println("Destory now") ;
}
}

Codeless 發表在 痞客邦 留言(0) 人氣()

Bean的scope包含:singleton(default)、prototyperequest、session、global-session

Codeless 發表在 痞客邦 留言(0) 人氣()

Abstract Factory Pattern相對於Simple Factory Pattern只是將不同的Factory抽象化後,而多了Abstract Factory這一層。
Manner.java

public interface Manner {
public void eatSomething() ;
}

Codeless 發表在 痞客邦 留言(0) 人氣()

驗證是否為JSON格式:
http://jsonlint.com/
利用JAVA直接抓取JSON格式範例如下:

package com.example;

import net.sf.json.JSONObject;

public class Test {

public static void main(String []args){
String tmp= "{\"Data\":{\"Name\":\"MichaelChan\",\"Email\":\"XXXX@XXX.com\",\"Phone\":[02-12345678,0911123456]}}";
JSONObject json = JSONObject.fromObject(tmp);
System.out.println(json.get("Data"));
System.out.println(((JSONObject)json.get("Data")).get("Name")); // MichaelChan
System.out.println(((JSONObject)json.get("Data")).get("Email")); // XXXX@XXX.com
System.out.println(((JSONObject)json.get("Data")).getJSONArray("Phone").get(0)); //02-12345678

}
}

Codeless 發表在 痞客邦 留言(0) 人氣()


Simple Factory Pattern
Simple Factory模式又稱Static Factory模式。一個Simple Factory生產成品,而對客戶端隱藏產品產生的細節,物件如何生成,生成前是否與其它物件建立依賴關係,客戶端皆不用理會,用以將物件生成方式之變化 與客戶端程式碼隔離。

Factory Method模式在一個抽象類別中留下某個建立元件的抽象方法沒有實作,其它與元件操作相關聯的方法都先依賴於元件所定義的介面,而不是依賴於元件的實現, 當您的成品中有一個或多個元件無法確定時,您先確定與這些元件的操作介面,然後用元件的抽象操作介面先完成其它的工作,元件的實作(實現)則推遲至實現元件介面的子類完成,一旦元件加入,即可完成您的成品。簡單地說,如果您希望如何建立父類別中用到的物件這件事,是由子類別來決定,可以使用Factory Method...

Codeless 發表在 痞客邦 留言(0) 人氣()

Spring 基本概念
Spring框架的核心就是Spring容器,主要是透過容器建立、設定、管理直到銷毀物件。容器主要是利用dependency injection (DI)去管理組成應用程式的元件(物件),而這些元件(物件)則稱為所謂的Beans。
Spring提供了下列兩種不同的容器:
Spring BeanFactory Container

Codeless 發表在 痞客邦 留言(0) 人氣()


作業環境:
O.S.: Windows 8
IDE: Eclipse Luna
安裝環境:
JDK:1.8
commons-logging:1.2
spring:4.1.6

Codeless 發表在 痞客邦 留言(0) 人氣()

藍色死當畫面 Kernal Stack Inpage Error#


A Kernel Stack Inpage Error is an issue within Microsoft Windows. The symptoms that present when this issue occurs are the following: a system crash and a system halt screen --- commonly referred to as the "blue screen of death." An issue with the Windows paging file typically causes this error, which is usually the result of a defective hard disk drive --- bad sectors are often the primary cause. The Microsoft Windows "chkdsk" command line utility can repair faulty hard disk drives with these symptoms and resolve the issues caused by the Kernel Stack Inpage Error

Codeless 發表在 痞客邦 留言(0) 人氣()


OS: Win XP SP3
Eclipse:Luna
Ant:1.9.4


Codeless 發表在 痞客邦 留言(0) 人氣()


第一種清除cache方式
1.首先將新export的war檔部署在指定路徑下

2.舊war檔需移除 stop > Force Stop Now (status is changed to prepared) > Delete

Codeless 發表在 痞客邦 留言(0) 人氣()

APP學習
MainActivity.java
Declare:
AlertDialog.Builder bdr ;  //利用AlertDialog.Builder物件建立歡迎訊息的交談窗  

Codeless 發表在 痞客邦 留言(0) 人氣()

« 1 2
Blog Stats
⚠️

成人內容提醒

本部落格內容僅限年滿十八歲者瀏覽。
若您未滿十八歲,請立即離開。

已滿十八歲者,亦請勿將內容提供給未成年人士。