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

This code example shows how to use the following methods:getName, getPublicKey
    public synchronized void addIdentity(Identity identity) throws KeyManagementException {
        if (identity == null) {
            throw new NullPointerException("identity == null");
        } 
 
        String name = identity.getName();
        if (names.containsKey(name)) {
            throw new KeyManagementException("name '" + name + "' is already used");
        } 
 
        PublicKey key = identity.getPublicKey();
        if (key != null && keys.containsKey(key)) {
            throw new KeyManagementException("key '" + key + "' is already used");
        } 
 
        names.put(name, identity);
        if (key != null) {
            keys.put(key, identity);
        } 
    } 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getName, getPublicKey
    public synchronized void addIdentity(Identity identity) throws KeyManagementException {
        if (identity == null) {
            throw new NullPointerException("identity == null");
        } 
 
        String name = identity.getName();
        if (names.containsKey(name)) {
            throw new KeyManagementException("name '" + name + "' is already used");
        } 
 
        PublicKey key = identity.getPublicKey();
        if (key != null && keys.containsKey(key)) {
            throw new KeyManagementException("key '" + key + "' is already used");
        } 
 
        names.put(name, identity);
        if (key != null) {
            keys.put(key, identity);
        } 
    } 
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getName, getPublicKey
			throws KeyManagementException {
		if (identity == null) {
			throw new NullPointerException(Messages.getString("security.92")); //$NON-NLS-1$
		} 
 
		final String name = identity.getName();
		if (names.containsKey(name)) {
			throw new KeyManagementException(Messages.getString(
					"security.93", name)); //$NON-NLS-1$
		} 
 
		final PublicKey key = identity.getPublicKey();
		if (key != null && keys.containsKey(key)) {
			throw new KeyManagementException(Messages.getString(
					"security.94", key)); //$NON-NLS-1$
		} 
 
		names.put(name, identity);
		if (key != null) {
			keys.put(key, identity);
5
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getScope
    public final void testIdentityScopeStringIdentityScope() throws Exception {
        IdentityScope scope = new IdentityScopeStub("my scope");
        is = new IdentityScopeStub("Aleksei Semenov", scope);
        assertNotNull(is);
        assertEquals("Aleksei Semenov", is.getName());
        assertEquals(scope.getName(), is.getScope().getName());
    } 
 
    /** 
     * just call IdentityScope.getSystemScope() 
     */ 
    public final void testGetSystemScope() { 
        String name = Security.getProperty("system.scope");
        assertNotNull(name);
        IdentityScope scope = IdentityScope.getSystemScope();
        assertNotNull(scope);
        assertEquals(name, scope.getClass().getName());
    } 
 
    /** 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
This code example shows how to use the following methods:getScope
    public final void testIdentityScopeStringIdentityScope() throws Exception { 
        IdentityScope scope = new IdentityScopeStub("my scope");
        is = new IdentityScopeStub("Aleksei Semenov", scope);
        assertNotNull(is);
        assertEquals("Aleksei Semenov", is.getName());
        assertEquals(scope.getName(), is.getScope().getName());
    } 
 
    /** 
     * just call IdentityScope.getSystemScope() 
     */ 
    public final void testGetSystemScope() { 
        String name = Security.getProperty("system.scope");
        assertNotNull(name);
        IdentityScope scope = IdentityScope.getSystemScope();
        assertNotNull(scope);
        assertEquals(name, scope.getClass().getName());
    } 
 
    /** 
4
CodeRank
Contextual code suggestions in your IDE  Get Codota for Java
See Code Examples for Java 8 Identity Methods: