com.facebook.presto.jdbc.internal.spi.security.GrantInfo Maven / Gradle / Ivy
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.facebook.presto.jdbc.internal.spi.security;
import com.facebook.presto.jdbc.internal.spi.SchemaTableName;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
public class GrantInfo
{
private final Set privilegeInfo;
private final Identity grantee;
private final SchemaTableName schemaTableName;
private final Optional grantor;
private final Optional withHierarchy;
public GrantInfo(Set privilegeInfo, Identity grantee, SchemaTableName schemaTableName, Optional grantor, Optional withHierarchy)
{
this.privilegeInfo = privilegeInfo;
this.grantee = grantee;
this.schemaTableName = schemaTableName;
this.grantor = grantor;
this.withHierarchy = withHierarchy;
}
public Set getPrivilegeInfo()
{
return privilegeInfo;
}
public Identity getIdentity()
{
return grantee;
}
public SchemaTableName getSchemaTableName()
{
return schemaTableName;
}
public Optional getGrantor()
{
return grantor;
}
public Optional getWithHierarchy()
{
return withHierarchy;
}
@Override
public int hashCode()
{
return Objects.hash(privilegeInfo, grantee, schemaTableName, grantor, withHierarchy);
}
@Override
public boolean equals(Object o)
{
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
GrantInfo grantInfo = (GrantInfo) o;
return Objects.equals(privilegeInfo, grantInfo.getPrivilegeInfo()) &&
Objects.equals(grantee, grantInfo.getIdentity()) &&
Objects.equals(schemaTableName, grantInfo.getSchemaTableName()) &&
Objects.equals(grantor, grantInfo.getGrantor()) &&
Objects.equals(withHierarchy, grantInfo.getWithHierarchy());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy