Java 8 Delegate - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Delegate class.

This code example shows how to use the following methods:getClass, get_interface_def
        org.omg.PortableServer.portable.Delegate delegate = _get_delegate();
        try { 
            // If the ORB's delegate class does not implement 
            // "Object get_interface_def(..)", this will throw 
            // an AbstractMethodError. 
            return delegate.get_interface_def(this);
        } catch( AbstractMethodError aex ) {
            // Call "InterfaceDef get_interface(..)" method using reflection. 
            try { 
                Class[] argc = { org.omg.PortableServer.Servant.class };
                java.lang.reflect.Method meth =
                     delegate.getClass().getMethod("get_interface", argc);
                Object[] argx = { this };
                return (org.omg.CORBA.Object)meth.invoke(delegate, argx);
            } catch( java.lang.reflect.InvocationTargetException exs ) {
                Throwable t = exs.getTargetException();
                if (t instanceof Error) {
                    throw (Error) t;
                } else if (t instanceof RuntimeException) {
                    throw (RuntimeException) t;
This code example shows how to use the following methods:non_existent
     * <code>_non_existent()</code> that can be overridden by derived servants. 
     * @return <code>non_existent</code> <code>true</code> if that object does 
     *           not exist,  <code>false</code> otherwise. 
    public boolean _non_existent() { 
        return _get_delegate().non_existent(this);
    // Ken and Simon will ask about editorial changes 
    // needed in IDL to Java mapping to the following 
    // signature. 
     * Returns an object in the Interface Repository 
     * which provides type information that may be useful to a program. 
     * <code>Servant</code> provides a default implementation of 
     * <code>_get_interface()</code> 
     * that can be overridden by derived servants if the default 
     * behavior is not adequate. 
     * @return <code>get_interface</code> type information that corresponds to this servant. 
See Code Examples for Java 8 Delegate Methods: