OSGi™ Service Platform
Core Specification

Release 4 Version 4.3

org.osgi.service.condpermadmin
Class ConditionInfo

java.lang.Object
  extended by org.osgi.service.condpermadmin.ConditionInfo

public class ConditionInfo
extends java.lang.Object

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:

Immutable

Constructor Summary
ConditionInfo(java.lang.String encodedCondition)
          Constructs a ConditionInfo object from the specified encoded ConditionInfo string.
ConditionInfo(java.lang.String type, java.lang.String[] args)
          Constructs a ConditionInfo from the specified type and args.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Determines the equality of two ConditionInfo objects.
 java.lang.String[] getArgs()
          Returns arguments of this ConditionInfo.
 java.lang.String getEncoded()
          Returns the string encoding of this ConditionInfo in a form suitable for restoring this ConditionInfo.
 java.lang.String getType()
          Returns the fully qualified class name of the condition represented by this ConditionInfo.
 int hashCode()
          Returns the hash code value for this object.
 java.lang.String toString()
          Returns the string representation of this ConditionInfo.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ConditionInfo

public ConditionInfo(java.lang.String type,
                     java.lang.String[] args)
Constructs a ConditionInfo from the specified type and args.

Parameters:
type - The fully qualified class name of the Condition represented by this ConditionInfo.
args - The arguments for the Condition. These arguments are available to the newly created Condition by calling the getArgs() method.
Throws:
java.lang.NullPointerException - If type is null.

ConditionInfo

public ConditionInfo(java.lang.String encodedCondition)
Constructs a ConditionInfo object from the specified encoded ConditionInfo string. White space in the encoded ConditionInfo string is ignored.

Parameters:
encodedCondition - The encoded ConditionInfo.
Throws:
java.lang.IllegalArgumentException - If the specified encodedCondition is not properly formatted.
See Also:
getEncoded()
Method Detail

getEncoded

public final java.lang.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:
The string encoding of this ConditionInfo.

toString

public java.lang.String toString()
Returns the string representation of this ConditionInfo. The string is created by calling the getEncoded method on this ConditionInfo.

Overrides:
toString in class java.lang.Object
Returns:
The string representation of this ConditionInfo.

getType

public final java.lang.String getType()
Returns the fully qualified class name of the condition represented by this ConditionInfo.

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

getArgs

public final java.lang.String[] getArgs()
Returns arguments of this ConditionInfo.

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

equals

public boolean equals(java.lang.Object obj)
Determines the equality of two ConditionInfo objects. This method checks that specified object has the same type and args as this ConditionInfo object.

Overrides:
equals in class java.lang.Object
Parameters:
obj - The object to test for equality with this ConditionInfo object.
Returns:
true if obj is a ConditionInfo, and has the same type and args as this ConditionInfo object; false otherwise.

hashCode

public int hashCode()
Returns the hash code value for this object.

Overrides:
hashCode in class java.lang.Object
Returns:
A hash code value for this object.

OSGi™ Service Platform
Core Specification

Release 4 Version 4.3

Copyright © OSGi Alliance (2000, 2012). All Rights Reserved. Licensed under the OSGi Specification License, Version 2.0