net.refractions.udig.core
Class AdapterUtil

java.lang.Object
  extended by net.refractions.udig.core.AdapterUtil

public class AdapterUtil
extends java.lang.Object

Methods to help manage adapters

Since:
1.1.0
Author:
jones

Field Summary
static AdapterUtil instance
           
 
Method Summary
 boolean canAdaptTo(java.lang.String targetClass, java.lang.Object obj)
          Determines if a class can be adapted based on its string representation.
 boolean canAdaptTo(java.lang.String targetClass, java.lang.Object obj, java.lang.ClassLoader classLoader)
          Determines if a class can be adapted based on its string representation.
 IAdaptable getAdaptable(java.lang.Object obj)
           
 IBlockingAdaptable getBlockingAdapter(java.lang.Object obj)
           
<T> T
getOperationTarget(java.lang.Class<T> target, java.lang.Object obj, IProgressMonitor monitor)
          Since the target object may not be the object that the operation actually operates on, the getOperationTarget() finds the real object and returns it or null if for some reason the operation can be performed on the target.
<T> T
getOperationTarget(java.lang.String targetClass, java.lang.Object obj, IProgressMonitor monitor)
          Since the target object may not be the object that the operation actually operates on, the getOperationTarget() finds the real object and returns it or null if for some reason the operation can be performed on the target.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

public static final AdapterUtil instance
Method Detail

canAdaptTo

public boolean canAdaptTo(java.lang.String targetClass,
                          java.lang.Object obj)
Determines if a class can be adapted based on its string representation.

Parameters:
targetClass - class name to check if adaptation can go to
obj - source object to adapt from
Returns:

canAdaptTo

public boolean canAdaptTo(java.lang.String targetClass,
                          java.lang.Object obj,
                          java.lang.ClassLoader classLoader)
Determines if a class can be adapted based on its string representation.

Parameters:
targetClass - class name to check if adaptation can go to
obj - source object to adapt from
classLoader - object to instantiate the class with
Returns:

getAdaptable

public IAdaptable getAdaptable(java.lang.Object obj)

getBlockingAdapter

public IBlockingAdaptable getBlockingAdapter(java.lang.Object obj)

getOperationTarget

public <T> T getOperationTarget(java.lang.String targetClass,
                                java.lang.Object obj,
                                IProgressMonitor monitor)
                     throws java.io.IOException
Since the target object may not be the object that the operation actually operates on, the getOperationTarget() finds the real object and returns it or null if for some reason the operation can be performed on the target.

Example:

A FeatureType readonly operation is called on a IResolve. The getOperationTarget would resolve(FeatureSource.class) and return the Feature Source for the operation.

Parameters:
target - the object the action is called on.
definition - the Configuration element definition of the operation.
monitor - The progress monitor for the operation job.
Returns:
Throws:
java.io.IOException

getOperationTarget

public <T> T getOperationTarget(java.lang.Class<T> target,
                                java.lang.Object obj,
                                IProgressMonitor monitor)
                     throws java.io.IOException
Since the target object may not be the object that the operation actually operates on, the getOperationTarget() finds the real object and returns it or null if for some reason the operation can be performed on the target.

Example:

A FeatureType readonly operation is called on a IResolve. The getOperationTarget would resolve(FeatureSource.class) and return the Feature Source for the operation.

Parameters:
target - the object the action is called on.
definition - the Configuration element definition of the operation.
monitor - The progress monitor for the operation job.
Returns:
Throws:
java.io.IOException