public class Capability
extends java.lang.Object
| Constructor and Description |
|---|
Capability()
Construct a new empty Capability
|
| Modifier and Type | Method and Description |
|---|---|
void |
addOperation(java.lang.String resource,
java.lang.String op)
Add an operation to an existing Capability instance for a
given resource.
|
void |
addResource(java.lang.String resource)
Add a resource to an existing Capability instance with an
empty set of operations.
|
void |
addResource(java.lang.String resource,
java.lang.String op)
Add a resource to an existing Capability instance with the
given single operation.
|
void |
addResource(java.lang.String resource,
java.lang.String[] ops)
Add a resource to an existing Capability instance with the
given set of operations.
|
static java.lang.String |
c14n(java.lang.String capability)
Convenience method to canonicalise a JSON capability expression
|
void |
removeOperation(java.lang.String resource,
java.lang.String op)
Remove an operation for a given resource.
|
void |
removeResource(java.lang.String resource)
Remove a resource from an existing Capability instance
|
java.lang.String |
toString()
Get the canonicalised String text for a Capability instance.
|
public static final java.lang.String c14n(java.lang.String capability)
throws AblyException
capability: - a capability string, which is the JSON text for the capabilityAblyException - if there is an error processing the given string
(if for example it is not valid JSON)public void addResource(java.lang.String resource,
java.lang.String[] ops)
resource - the resource stringops - a String[] of the operations permitted for this resource;
the array does not need to be sortedpublic void addResource(java.lang.String resource,
java.lang.String op)
resource - the resource stringop - a single operation String to be permitted for this resource;public void addResource(java.lang.String resource)
resource - the resource stringpublic void removeResource(java.lang.String resource)
resource - the (possibly existing) resourcepublic void addOperation(java.lang.String resource,
java.lang.String op)
resource - the resource stringop - a single operation String to be added for this resource;public void removeOperation(java.lang.String resource,
java.lang.String op)
resource - the resource stringop - a operation String to be removed for this resource;public java.lang.String toString()
toString in class java.lang.Object