Top Description Fields Constructors Methods
org.osgi.service.condpermadmin

public Class ConditionInfo

extends Object
Class Inheritance
Imports
java.util.ArrayList, .List

Condition representation used by the Conditional Permission Admin service.

This class encapsulates two pieces of information: a Condition type (class name), which must implement Condition, and the arguments passed to its constructor.

In order for a Condition represented by a ConditionInfo to be instantiated and considered during a permission check, its Condition class must be available from the system classpath.

The Condition class must either:

Author
$Id: f96821be9ea49552285ed5eb699b05371f7f9ba8 $

Field Summary

Modifier and TypeField and Description
private final String[]
private final String

Constructor Summary

AccessConstructor and Description
public
ConditionInfo(String
The fully qualified class name of the Condition represented by this ConditionInfo.
type
,
String[]
The arguments for the Condition. These arguments are available to the newly created Condition by calling the getArgs() method.
args
)

Constructs a ConditionInfo from the specified type and args.

public
ConditionInfo(String
The encoded ConditionInfo.
encodedCondition
)

Constructs a ConditionInfo object from the specified encoded ConditionInfo string.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if obj is a ConditionInfo, and has the same type and args as this ConditionInfo object; false otherwise.
equals
(Object
The object to test for equality with this ConditionInfo object.
obj
)

Overrides java.lang.Object.equals.

Determines the equality of two ConditionInfo objects.

private static void
escapeString(String str, StringBuilder output)

This escapes the quotes, backslashes, \n, and \r in the string using a backslash and appends the newly escaped string to a StringBuilder.

public final String[]

Returns:

The arguments of this ConditionInfo. An empty array is returned if the ConditionInfo has no arguments.
getArgs
()

Returns arguments of this ConditionInfo.

public final String

Returns:

The string encoding of this ConditionInfo.
getEncoded
()

Returns the string encoding of this ConditionInfo in a form suitable for restoring this ConditionInfo.

public final String

Returns:

The fully qualified class name of the condition represented by this ConditionInfo.
getType
()

Returns the fully qualified class name of the condition represented by this ConditionInfo.

public int

Returns:

A hash code value for this object.
hashCode
()

Overrides java.lang.Object.hashCode.

Returns the hash code value for this object.

public String

Returns:

The string representation of this ConditionInfo.
toString
()

Overrides java.lang.Object.toString.

Returns the string representation of this ConditionInfo.

private static String
unescapeString(char[] str, int begin, int end)

Takes an encoded character array and decodes it into a new String.

Inherited from java.lang.Object:
clonefinalizegetClassnotifynotifyAllwaitwaitwait

Field Detail

argsback to summary
private final String[] args
typeback to summary
private final String type

Constructor Detail

ConditionInfoback to summary
public ConditionInfo(String type, String[] args)

Constructs a ConditionInfo from the specified type and args.

Parameters
type:String

The fully qualified class name of the Condition represented by this ConditionInfo.

args:String[]

The arguments for the Condition. These arguments are available to the newly created Condition by calling the getArgs() method.

Exceptions
NullPointerException:
If type is null.
ConditionInfoback to summary
public ConditionInfo(String encodedCondition)

Constructs a ConditionInfo object from the specified encoded ConditionInfo string. White space in the encoded ConditionInfo string is ignored.

Parameters
encodedCondition:String

The encoded ConditionInfo.

Exceptions
IllegalArgumentException:
If the specified encodedCondition is not properly formatted.
See Also
getEncoded()

Method Detail

equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Determines the equality of two ConditionInfo objects. This method checks that specified object has the same type and args as this ConditionInfo object.

Parameters
obj:Object

The object to test for equality with this ConditionInfo object.

Returns:boolean

true if obj is a ConditionInfo, and has the same type and args as this ConditionInfo object; false otherwise.

Annotations
@Override
escapeStringback to summary
private static void escapeString(String str, StringBuilder output)

This escapes the quotes, backslashes, \n, and \r in the string using a backslash and appends the newly escaped string to a StringBuilder.

getArgsback to summary
public final String[] getArgs()

Returns arguments of this ConditionInfo.

Returns:String[]

The arguments of this ConditionInfo. An empty array is returned if the ConditionInfo has no arguments.

getEncodedback to summary
public final String getEncoded()

Returns the string encoding of this ConditionInfo in a form suitable for restoring this ConditionInfo.

The encoded format is:

  [type "arg0" "arg1" ...]
where argN are strings that must be encoded for proper parsing. Specifically, the ", \, carriage return, and line feed characters must be escaped using \", \\, \r, and \n, respectively.

The encoded string contains no leading or trailing whitespace characters. A single space character is used between type and "arg0" and between the arguments.

Returns:String

The string encoding of this ConditionInfo.

getTypeback to summary
public final String getType()

Returns the fully qualified class name of the condition represented by this ConditionInfo.

Returns:String

The fully qualified class name of the condition represented by this ConditionInfo.

hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Returns the hash code value for this object.

Returns:int

A hash code value for this object.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Returns the string representation of this ConditionInfo. The string is created by calling the getEncoded method on this ConditionInfo.

Returns:String

The string representation of this ConditionInfo.

Annotations
@Override
unescapeStringback to summary
private static String unescapeString(char[] str, int begin, int end)

Takes an encoded character array and decodes it into a new String.