Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Java Interface
- public interface TaGrpService {
- public void execute(String group, Set<CoreMetaData> set) throws Exception;
- }
- Clojure Proxy and Implementation of body
- (def group-service (proxy [TaGrpService] []
- (execute [group set]
- (print-group group set))))
- ;; HERE I WANT TO PRINT THE GROUP AND THE CHILDREN IN THE SET s
- (defn print-group [group s]
- (prn (str "Group: " group))
- (for [x s]
- (prn (str " " (.name (.getFuncInfo x))))
- ))
- ; How i execute the service, an internal function takes the implementation of inteface and does work.
- (CoreMetaData/forEachGrp group-service)
- ;; OUTPUT
- (CoreMetaData/forEachGrp group-service)
- "Group: Cycle Indicators"
- "Group: Math Operators"
- "Group: Math Transform"
- "Group: Momentum Indicators"
- "Group: Overlap Studies"
- "Group: Pattern Recognition"
- "Group: Price Transform"
- "Group: Statistic Functions"
- "Group: Volatility Indicators"
- "Group: Volume Indicators"
- nil
- ;; IF I CHANGE IMPLEMENTATION OF print-group to...
- (defn print-group [group functions]
- (prn [(class group) (class functions)])
- )
- OUTPUT IS:
- [java.lang.String java.util.TreeSet]
- --snip---
- [java.lang.String java.util.TreeSet]
- nil
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement