Java 8 NameClassPair - 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 NameClassPair class.

This code example shows how to use the following methods:getClassName, getObject, getName
 
    public Binding next()
        throws NamingExceptionBinding b = (Binding)_delegate.next();
        return new Binding (b.getName(), b.getClassName(), b.getObject(), true);
    } 
 
    public boolean hasMoreElements() 
    { 
        return _delegate.hasNext();
    } 
 
    public Binding nextElement()
    { 
        Binding b = (Binding)_delegate.next();
        return new Binding (b.getName(), b.getClassName(), b.getObject(),true);
    } 
} 
6
CodeRank
This code example shows how to use the following methods:getClassName, getName
 
    public NameClassPair next()
        throws NamingExceptionBinding b = _delegate.next();
        return new NameClassPair(b.getName(),b.getClassName(),true);
    } 
 
    public boolean hasMoreElements() 
    { 
        return _delegate.hasNext();
    } 
 
    public NameClassPair nextElement()
    { 
        Binding b = _delegate.next();
        return new NameClassPair(b.getName(),b.getClassName(),true);
    } 
} 
6
CodeRank
This code example shows how to use the following methods:
    } 
 
    private void setupNamingEnumeration(NameClassPair listResult)
            throws NamingException {
        when(namingEnumerationMock.hasMore()).thenReturn(true, false);
        when(namingEnumerationMock.next()).thenReturn(listResult);
    } 
 
    @Test
    public void testList_Name() throws NamingException {
        expectGetReadOnlyContext(); 
 
        NameClassPair listResult = new NameClassPair(NAME, CLASS);
 
        setupListAndNamingEnumeration(listResult);
 
        List list = tested.list(nameMock);
 
        verify(dirContextMock).close();
        verify(namingEnumerationMock).close();

5
CodeRank
This code example shows how to use the following methods:getName, isRelative
    /** 
     * @param searchResult 
     * @param parent 
     */ 
    public LdapEntryNode(SearchResult searchResult, ILdapEntryNode parent) {
        this.sourceBaseName = searchResult.getName();
        this.parent = parent;
        this.relative = searchResult.isRelative();
        setLabel(getSourceBaseName()); 
    } 
 
    @Override 
    public boolean isRoot() { 
        return false; 
    } 
 
    @Override 
    public boolean isRelative() { 
        return relative;
    } 
4
CodeRank
This code example shows how to use the following methods:getNameInNamespace, getAttributes
This code example shows how to use the following methods:getName, getAttributes
        SearchControls searchControls = new SearchControls();
        searchControls.setSearchScope( SearchControls.ONELEVEL_SCOPE );
        NamingEnumeration<SearchResult> results = ctx.search( "ou=system", "(pwdLastSet=3)", searchControls );
        assertTrue( results.hasMore() );
        SearchResult result = results.next();
        assertNotNull( result );
        assertEquals( "cn=foobar", result.getName() );
        Attributes attributes = result.getAttributes();
        assertEquals( "3", attributes.get( "pwdLastSet" ).get() );
        results.close();
 
        // Now search with bogus value for pwdLastSet 
        results = ctx.search( "ou=system", "(pwdLastSet=300)", searchControls );
        assertFalse( results.hasMore() );
        results.close();
    } 
 
 
    /** 
     * Test case for DIRSERVER-: Ensure that schema entry is returned, 
4
CodeRank
This code example shows how to use the following methods:getClassName, getName, getAttributes
            //			 DirContext ictx = new InitialDirContext(ldapEnv); 
            //			 NamingEnumeration<SearchResult> e = ldapContext.search("ou=monorganisationunit,dc=placeoweb", critere, controle); 
            NamingEnumeration<SearchResult> e = ldapContext.search(Play.configuration.getProperty("ldap.dn"), critere, controle);
            while (e.hasMore()) {
                SearchResult r = e.next();
                System.out.println("name: " + r.getName());
                System.out.println("object: " + r.getClassName());
                System.out.println("getAttributes: " + r.getAttributes());
                //System.out.println("bigsiri: " + r.getAttributes().get("userPassword").getID()); 
                //listerAttributs(r.getAttributes()); 
 
                return r.getAttributes();
            } 
 
        } catch (AuthenticationException error) {
            return null; 
 
        } catch (NamingException ex) {
            Logger.getLogger(Ldap.class.getName()).log(Level.SEVERE, null, ex);
        } 
4
CodeRank
This code example shows how to use the following methods:getClassName, getObject, getName
        localContext.createSubcontext("test").bind("nested", "TestValue");
 
        final NamingEnumeration<Binding> entries = remoteContext.listBindings("");
        assertTrue(entries.hasMore());
        final Binding binding = entries.next();
        assertEquals("test", binding.getName());
        assertEquals(Context.class.getName(), binding.getClassName());
        assertEquals("TestValue", Context.class.cast(binding.getObject()).lookup("nested"));
        assertFalse(entries.hasMore());
 
        localContext.unbind("test");
    } 
 
 
    @Test
    public void testUnbind() throws Exception {
        localContext.bind("test", "TestValue1");
        remoteContext.unbind("test");
        try { 
            localContext.lookup("test");
4
CodeRank
This code example shows how to use the following methods:
 
        public Object nextElement() 
        { 
            Map.Entry entry = getNext();
 
            return new NameClassPair((String) entry.getKey(), entry.getValue().getClass().getName());
        } 
    } 
 
    private class ListBindingEnumeration extends LocalNamingEnumeration 
    { 
        public Object next() throws NamingException
        { 
            return nextElement();
        } 
 
        public Object nextElement() 
        { 
            Map.Entry entry = getNext();
 
4
CodeRank
This code example shows how to use the following methods:
        } 
 
        public Object nextElement() 
        { 
            Map.Entry entry = getNext();
            return new NameClassPair((String) entry.getKey(), entry.getValue().getClass().getName());
        } 
    } 
 
    private class ListBindingEnumeration extends AbstractLocalNamingEnumeration 
    { 
 
        public Object next() throws NamingException
        { 
            return nextElement();
        } 
 
        public Object nextElement() 
        { 
            Map.Entry entry = getNext();
4
CodeRank
See Code Examples for Java 8 NameClassPair Methods: