Package org.osgi.service.condpermadmin
Class ConditionInfo
- java.lang.Object
-
- org.osgi.service.condpermadmin.ConditionInfo
-
public class ConditionInfo extends java.lang.ObjectCondition 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
ConditionInfoto be instantiated and considered during a permission check, its Condition class must be available from the system classpath.The Condition class must either:
- Declare a public static
getConditionmethod that takes aBundleobject and aConditionInfoobject as arguments. That method must return an object that implements theConditioninterface. - Implement the
Conditioninterface and define a public constructor that takes aBundleobject and aConditionInfoobject as arguments.
- Declare a public static
-
-
Constructor Summary
Constructors Constructor Description ConditionInfo(java.lang.String encodedCondition)Constructs aConditionInfoobject from the specified encodedConditionInfostring.ConditionInfo(java.lang.String type, java.lang.String[] args)Constructs aConditionInfofrom the specified type and args.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)Determines the equality of twoConditionInfoobjects.java.lang.String[]getArgs()Returns arguments of thisConditionInfo.java.lang.StringgetEncoded()Returns the string encoding of thisConditionInfoin a form suitable for restoring thisConditionInfo.java.lang.StringgetType()Returns the fully qualified class name of the condition represented by thisConditionInfo.inthashCode()Returns the hash code value for this object.java.lang.StringtoString()Returns the string representation of thisConditionInfo.
-
-
-
Constructor Detail
-
ConditionInfo
public ConditionInfo(java.lang.String type, java.lang.String[] args)Constructs aConditionInfofrom the specified type and args.- Parameters:
type- The fully qualified class name of the Condition represented by thisConditionInfo.args- The arguments for the Condition. These arguments are available to the newly created Condition by calling thegetArgs()method.- Throws:
java.lang.NullPointerException- Iftypeisnull.
-
ConditionInfo
public ConditionInfo(java.lang.String encodedCondition)
Constructs aConditionInfoobject from the specified encodedConditionInfostring. White space in the encodedConditionInfostring is ignored.- Parameters:
encodedCondition- The encodedConditionInfo.- Throws:
java.lang.IllegalArgumentException- If the specifiedencodedConditionis not properly formatted.- See Also:
getEncoded()
-
-
Method Detail
-
getEncoded
public final java.lang.String getEncoded()
Returns the string encoding of thisConditionInfoin a form suitable for restoring thisConditionInfo.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 thisConditionInfo. The string is created by calling thegetEncodedmethod on thisConditionInfo.- Overrides:
toStringin classjava.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 thisConditionInfo.- Returns:
- The fully qualified class name of the condition represented by
this
ConditionInfo.
-
getArgs
public final java.lang.String[] getArgs()
Returns arguments of thisConditionInfo.- Returns:
- The arguments of this
ConditionInfo. An empty array is returned if theConditionInfohas no arguments.
-
equals
public boolean equals(java.lang.Object obj)
Determines the equality of twoConditionInfoobjects. This method checks that specified object has the same type and args as thisConditionInfoobject.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- The object to test for equality with thisConditionInfoobject.- Returns:
trueifobjis aConditionInfo, and has the same type and args as thisConditionInfoobject;falseotherwise.
-
hashCode
public int hashCode()
Returns the hash code value for this object.- Overrides:
hashCodein classjava.lang.Object- Returns:
- A hash code value for this object.
-
-