Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 04b87fcf4245a1dd57153fc141160b4b986afe59 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*******************************************************************************
 * Copyright (c) 2018 Connexta, LLC and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Connexta, LLC - initial implementation
 *******************************************************************************/
package org.eclipse.osgi.internal.permadmin;

import java.security.Permission;
import java.util.Objects;

class EvaluationCacheKey {

    private final Permission permission;

    private final Long bundleId;

    EvaluationCacheKey(BundlePermissions bundlePermissions, Permission permission) {
        this.permission = permission;
        this.bundleId = bundlePermissions.getBundle().getBundleId();
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        EvaluationCacheKey that = (EvaluationCacheKey) o;
        return Objects.equals(bundleId, that.bundleId) && Objects.equals(
                permission,
                that.permission);
    }

    @Override
    public int hashCode() {
        return Objects.hash(bundleId, permission);
    }
}

Back to the top