Skip to content

gavinking/ceylon.proxy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cross-platform interceptors for Ceylon

A tiny library that defining a proxy() function which allows an Interceptor for method invocation and attribute evaluation to be attached to a Ceylon object.

This library works on both JVM and JavaScript VMs.

Requirements

Ceylon 1.3.2 is required.

For the proxy() function to work correctly on the JVM, EE compiler mode must be enabled.

Example

value person = Person("Gavin");

Person proxiedPerson = proxy {
    person;
    object handler satisfies Interceptor<Person> {

        shared actual Return call<Return,Args>
            (Person target, String name, Args args, Return method(Args args))
                given Args satisfies Anything[] {
            print("calling '``name``()' with args ``args``");
            return method(args);
        }

        shared actual Type get<Type>
            (Person target, String name, Type attribute) {
            print("got '``name``'");
            return attribute;
        }

    }
};

About

A tiny library for proxying Ceylon objects

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published