Package com.impossibl.postgres.api.data
Class ACLItem
- java.lang.Object
-
- com.impossibl.postgres.api.data.ACLItem
-
public class ACLItem extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
ACLItem.Right
-
Field Summary
Fields Modifier and Type Field Description static char[]
ALL_PRIVILEGE_CHARS
static String
ALL_PRIVILEGES
static ACLItem.Right[]
ALL_RIGHTS
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(Object o)
String
getGrantor()
String
getPrivileges()
ACLItem.Right[]
getRights()
String
getUser()
int
hashCode()
static boolean
isPrivilege(char ch)
Test is a character is a privilege code.static ACLItem
parse(String aclItemStr)
static char[]
privilegesOf(ACLItem.Right[] rights)
Produce a string of privileges matching the provided rights.static ACLItem.Right[]
rightsOf(String rightsOrPrivileges)
Parse a rights string into rights objects.void
setGrantor(String grantor)
void
setPrivileges(String privileges)
void
setRights(ACLItem.Right[] rights)
void
setRights(String rights)
void
setUser(String user)
String
toString()
-
-
-
Field Detail
-
ALL_PRIVILEGES
public static final String ALL_PRIVILEGES
- See Also:
- Constant Field Values
-
ALL_PRIVILEGE_CHARS
public static final char[] ALL_PRIVILEGE_CHARS
-
ALL_RIGHTS
public static final ACLItem.Right[] ALL_RIGHTS
-
-
Method Detail
-
isPrivilege
public static boolean isPrivilege(char ch)
Test is a character is a privilege code.
-
rightsOf
public static ACLItem.Right[] rightsOf(String rightsOrPrivileges) throws ParseException
Parse a rights string into rights objects. Because privilege strings are also valid rights string the parsing supports both formats.- Parameters:
rightsOrPrivileges
- String of rights or privileges to parse.- Returns:
- Array of
ACLItem.Right
s representing the string of rights or privileges. - Throws:
ParseException
- If a privilege is not an alphabetic character.
-
privilegesOf
public static char[] privilegesOf(ACLItem.Right[] rights)
Produce a string of privileges matching the provided rights. Grant options from the each right are ignored.- Parameters:
rights
- Rights to serialize- Returns:
- Privilege string matching the provided rights
-
getUser
public String getUser()
-
setUser
public void setUser(String user)
-
getPrivileges
public String getPrivileges()
-
setPrivileges
public void setPrivileges(String privileges)
-
getRights
public ACLItem.Right[] getRights()
-
setRights
public void setRights(ACLItem.Right[] rights)
-
setRights
public void setRights(String rights) throws ParseException
- Throws:
ParseException
-
getGrantor
public String getGrantor()
-
setGrantor
public void setGrantor(String grantor)
-
parse
public static ACLItem parse(String aclItemStr) throws ParseException
- Throws:
ParseException
-
-