//被代理接口
interface ClothFactory{
public void productCloth();
}
//被代理类
class NikeClothFactory implements ClothFactory{
@Override
public void productCloth() {
System.out.println("Nike 生产衣服");
}
}...
分类:
其他好文 时间:
2014-10-27 15:43:54
阅读次数:
189
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
import java.lang.reflect.Proxy;
//接口
interface MyInterface {
public void action();
}
// 被代理类
class MyObject implements ...
分类:
其他好文 时间:
2014-10-27 15:42:35
阅读次数:
179
??
interface Work{
public void doWork();
}
class StudentWork implements Work{
@Override
public void doWork() {
System.out.println("student 写作业");
}
}
class TeacherWork implements Work{
@...
分类:
其他好文 时间:
2014-10-27 15:41:24
阅读次数:
140
这篇看一下时限队列锁的一种实现方式。 java并发包中的Lock定义包含了时限锁的接口:
public interface Lock {
void lock();
void lockInterruptibly() throws InterruptedException;
boolean tryLock();
boolean tryLock(long t...
分类:
其他好文 时间:
2014-10-27 14:27:59
阅读次数:
169
1. Bound Services A bound service is the server in a client-server interface. A bound service allows components (such as activities) to bind to the s....
分类:
移动开发 时间:
2014-10-27 12:28:20
阅读次数:
250
转载:http://wangyang0311.iteye.com/blog/368031一般来说分为以下几步:声明回调函数的统一接口interface A,包含方法callback();在调用类caller内将该接口设置为私有成员private A XXX;在caller内提供实现A接口的publi...
分类:
编程语言 时间:
2014-10-27 10:45:51
阅读次数:
178
PayTax(299); // interface 接口名 // { // const 常量名=赋初始值; //} //访问方式 类名::常量名 //接口名::常量名?>
分类:
Web程序 时间:
2014-10-26 22:50:54
阅读次数:
185
unit?uGetTickCount64;
interface
uses?windows;
?function?_GetTickCount64():?Int64;
implementation
type
????LARGE_INTEGER?=?record
??????lowpart??:integer?;
??????highpart?...
分类:
其他好文 时间:
2014-10-26 17:08:25
阅读次数:
407
再讲java动态代理前,先来看看代理模式。Proxy类通过组合,对Hello类进行了增强,并对其进行了委托。代理模式代码:public class ProxyPattern { interface IHello{ void say() ; } static class Hello implement...
分类:
编程语言 时间:
2014-10-26 16:54:40
阅读次数:
251
1.Futrue
public interface Future //Future 表示异步计算的结果ExecutorService threadPool = Executors.newSingleThreadExecutor();
Future future = threadPool.submit(new Callable() {
public String call() throws Ex...
分类:
编程语言 时间:
2014-10-26 15:40:38
阅读次数:
159