Class AbstractPrivilege
java.lang.Object
org.pgcodekeeper.core.database.base.schema.AbstractPrivilege
- All Implemented Interfaces:
IPrivilege,IHashable
- Direct Known Subclasses:
ChPrivilege,MsPrivilege,PgPrivilege
Represents a database privilege (GRANT/REVOKE) for a database object.
Handles privilege operations including creation, dropping, and SQL generation
for different database types.
-
Field Summary
Fields inherited from interface org.pgcodekeeper.core.database.api.schema.IPrivilege
GRANT, REVOKE, WITH_GRANT_OPTION -
Method Summary
Modifier and TypeMethodDescriptionvoidcomputeHash(Hasher hasher) Computes the hash of the implementing object using the provided hasher.booleanGenerates the SQL statement for this privilege.Generates the SQL statement to drop this privilege.getName()getRole()inthashCode()booleanisRevoke()Checks if this privilege represents a REVOKE operation.toString()
-
Method Details
-
isRevoke
public boolean isRevoke()Description copied from interface:IPrivilegeChecks if this privilege represents a REVOKE operation.- Specified by:
isRevokein interfaceIPrivilege- Returns:
- true if this is a REVOKE privilege, false if GRANT
-
getCreationSQL
Description copied from interface:IPrivilegeGenerates the SQL statement for this privilege.- Specified by:
getCreationSQLin interfaceIPrivilege- Returns:
- the GRANT or REVOKE SQL statement
-
getDropSQL
Description copied from interface:IPrivilegeGenerates the SQL statement to drop this privilege.- Specified by:
getDropSQLin interfaceIPrivilege- Returns:
- the REVOKE SQL statement, or null if this is already a REVOKE
-
getPermission
- Specified by:
getPermissionin interfaceIPrivilege- Returns:
- the permission type (e.g., SELECT, INSERT, ALL)
-
getRole
- Specified by:
getRolein interfaceIPrivilege- Returns:
- role the role receiving or losing the privilege
-
getName
- Specified by:
getNamein interfaceIPrivilege- Returns:
- the object name the privilege applies to
-
equals
-
hashCode
public int hashCode() -
computeHash
Description copied from interface:IHashableComputes the hash of the implementing object using the provided hasher. The implementation should call appropriateputmethods on the hasher for all fields that should contribute to the hash value.- Specified by:
computeHashin interfaceIHashable- Parameters:
hasher- the hasher instance to use for hash computation
-
toString
-