Package org.eclipse.core.expressions
Class PropertyTester
- java.lang.Object
-
- org.eclipse.core.expressions.PropertyTester
-
- All Implemented Interfaces:
IPropertyTester
public abstract class PropertyTester extends Object implements IPropertyTester
Abstract superclass of all property testers. Implementation classes of the extension pointorg.eclipse.core.expresssions.propertyTestersmust extendPropertyTester.A property tester implements the property tests enumerated in the property tester extension point. For the following property test extension
<propertyTester namespace="org.eclipse.jdt.core" id="org.eclipse.jdt.core.IPackageFragmentTester" properties="isDefaultPackage" type="org.eclipse.jdt.core.IPackageFragment" class="org.eclipse.demo.MyPackageFragmentTester"> </propertyTester>the corresponding implementation class looks like:public class MyPackageFragmentTester extends PropertyTester { public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { IPackageFragment fragment= (IPackageFragment)receiver; if ("isDefaultPackage".equals(property)) { return expectedValue == null ? fragment.isDefaultPackage() : fragment.isDefaultPackage() == ((Boolean)expectedValue).booleanValue(); } Assert.isTrue(false); return false; } }The property can then be used in a test expression as follows:<instanceof value="org.eclipse.core.IPackageFragment"/> <test property="org.eclipse.jdt.core.isDefaultPackage"/>
There is no guarantee that the same instance of a property tester is used to handle <test property="..."/> requests. So property testers should always be implemented in a stateless fashion.
- Since:
- 3.0
-
-
Constructor Summary
Constructors Constructor Description PropertyTester()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanhandles(String namespace, String property)Returns whether the property tester can handle the given property or not.IPropertyTesterinstantiate()Loads the implementation class for this property tester and returns an instance of this class.org.eclipse.core.internal.expressions.PropertyTesterDescriptorinternalCreateDescriptor()Note: this method is for internal use only.voidinternalInitialize(org.eclipse.core.internal.expressions.PropertyTesterDescriptor descriptor)Initialize the property tester with the given name space and property.booleanisDeclaringPluginActive()Returnstrueif the implementation class of this property tester can be loaded.booleanisInstantiated()Returns whether the implementation class for this property tester is loaded or not.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.eclipse.core.expressions.IPropertyTester
test
-
-
-
-
Method Detail
-
internalInitialize
public final void internalInitialize(org.eclipse.core.internal.expressions.PropertyTesterDescriptor descriptor)
Initialize the property tester with the given name space and property.Note: this method is for internal use only. Clients must not call this method.
- Parameters:
descriptor- the descriptor object for this tester- Restriction:
- This method is not intended to be referenced by clients.
-
internalCreateDescriptor
public final org.eclipse.core.internal.expressions.PropertyTesterDescriptor internalCreateDescriptor()
Note: this method is for internal use only. Clients must not call this method.- Returns:
- the property tester descriptor
- Restriction:
- This method is not intended to be referenced by clients.
-
handles
public final boolean handles(String namespace, String property)
Description copied from interface:IPropertyTesterReturns whether the property tester can handle the given property or not.- Specified by:
handlesin interfaceIPropertyTester- Parameters:
namespace- the name space to be consideredproperty- the property to test- Returns:
trueif the tester provides an implementation for the given property; otherwisefalseis returned
-
isInstantiated
public final boolean isInstantiated()
Description copied from interface:IPropertyTesterReturns whether the implementation class for this property tester is loaded or not.- Specified by:
isInstantiatedin interfaceIPropertyTester- Returns:
trueif the implementation class is loaded;falseotherwise
-
isDeclaringPluginActive
public boolean isDeclaringPluginActive()
Description copied from interface:IPropertyTesterReturnstrueif the implementation class of this property tester can be loaded. This is the case if the plug-in providing the implementation class is active. Returnsfalseotherwise.- Specified by:
isDeclaringPluginActivein interfaceIPropertyTester- Returns:
- whether the implementation class can be loaded or not
-
instantiate
public final IPropertyTester instantiate()
Description copied from interface:IPropertyTesterLoads the implementation class for this property tester and returns an instance of this class.- Specified by:
instantiatein interfaceIPropertyTester- Returns:
- an instance of the implementation class for this property tester
-
-