GnuSmalltalkUsersGuide:BaseChapter 127

From 흡혈양파의 번역工房
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
PluggableAdaptor

PluggableAdaptor

네임스페이스 Smalltalk에 정의됨

슈퍼클래스: ValueAdaptor

범주: 언어-데이터 타입


나는 ValueAdaptors가 사용하는 #value/#value: 프로토콜과 복잡한 get/set 행위 간을 조정한다. Get/set 행위는 두 개의 블록에 의해 구현되거나, 얻는 데에는 #someProperty를, 설정하는 데에는 #someProperty: 와 같은 메시지를 이용해 다른 객체로 위임할 수 있다.


PluggableAdaptor 클래스: 인스턴스 생성하기

getBlock: getBlock putBlock: putBlock

#value와 #value: 를 구현하기 위해 주어진 블록을 이용하는 PluggableAdaptor를 응답하라.

on: anObject aspect: aSymbol

#value를 구현하기 위해 anObject의 aSymbol 메시지, #value:를 구현하기 위해 anObject의 aSymbol: (aSymbol 다음에 콜론 추가) 메시지를 이용하는 PluggableAdaptor를 응답하라.

on: anObject getSelector: getSelector putSelector: putSelector

#value를 구현하기 위해 anObject의 getSelector 메시지, #value: 를 구현하기 위해 anObject의 putSelector 메시지를 이용하는 PluggableAdaptor를 응답하라.

on: anObject index: anIndex

#value와 #value:를 구현하기 위해 anObject의 #at: 과 #at:put: 메시지를 이용하는 PluggableAdaptor를 응답하라; #at: 과 #at:put: 의 첫 번째 매개변수는 anIndex이다.

on: aDictionary key: aKey

#on:index:와 같다. 명확성과 완전성을 위해 제공됨.


PluggableAdaptor: 접근하기

value

수신자의 값을 얻어라.

value: anObject

수신자의 값을 설정하라.


Notes