All Packages Class Hierarchy This Package Previous Next Index
Class com.ibm.beans.demos.travel.flight.rules.ConnectingFlightDip
java.lang.Object
|
+----com.ibm.beans.dip.SimpleDip
|
+----com.ibm.beans.demos.travel.flight.rules.ConnectingFlightDip
- public class ConnectingFlightDip
- extends SimpleDip
- implements DipPropertyChangeListener, Serializable
This class implements a business rule which restricts the use of
direct flights returned by the FlightInfoDapProperties when the direct flight
cost above some threshold over a connecting flight. It does this by
hooking to the flight info property and filtering the results provided
by the FlightInfoDapProperties. The threshold amount is a settable property.
-
ConnectingFlightDip()
-
-
createImplementation(Object)
- Checks the object to which the dip is being applied to
ensure that the object is a FlightInfoDapProperties.
-
createPropertyChangeListener(Object, String[])
- Creates the object to receive notification when the flight info property changes.
-
getPriceDifferential()
- Gets the name price differential for allowing
direct flights.
-
includeInMorphedClass(String)
- Determines if a method should be included in a morphed class.
-
propertyChange(PropertyChangeEvent)
- Handles a property change event.
-
setPriceDifferential(double)
- Sets the dollar amount threshold before connecting flights
are chosen over direct flights.
-
typeName()
- Defines this dip to be related to restricting use of
direct flights.
ConnectingFlightDip
public ConnectingFlightDip()
setPriceDifferential
public void setPriceDifferential(double dollarAmount)
- Sets the dollar amount threshold before connecting flights
are chosen over direct flights. For instance, if a dollar
amount of $100 is set, any direct flights which costs more
than $100 than a connecting flight will not be allowed.
getPriceDifferential
public double getPriceDifferential()
- Gets the name price differential for allowing
direct flights.
typeName
public final String typeName()
- Defines this dip to be related to restricting use of
direct flights.
- Returns:
- The type name of the dip.
- Overrides:
- typeName in class SimpleDip
includeInMorphedClass
public boolean includeInMorphedClass(String methodName)
- Determines if a method should be included in a morphed class.
When the dip is applied to a class as a pre-dip during morphing,
and the user elects to only override those methods in the dippable
class that the pre-dips agrees to, this method is used to determine
if a dip agrees to including a specific method.
The only method of the dippable bean that the ConnectingFlihgtDip
needs to be wrapped is the setFlightInfo method.
- Parameters:
- methodName - Name of the method to be considered
- Returns:
- boolean indicating whether to wrap given method
- Overrides:
- includeInMorphedClass in class SimpleDip
createImplementation
public Object createImplementation(Object obj) throws DipRejectAdditionException
- Checks the object to which the dip is being applied to
ensure that the object is a FlightInfoDapProperties. If it is
not, then an exception is thrown and the application of the dip
is rejected.
- Parameters:
- obj - The bean being dipped.
- Throws: DipRejectAdditionException
- This method will throw
this exception if
obj is not a FlightInfoDapProperties.
- Overrides:
- createImplementation in class SimpleDip
createPropertyChangeListener
public DipPropertyChangeListener[] createPropertyChangeListener(Object imp,
String methods[]) throws DipRejectAdditionException
- Creates the object to receive notification when the flight info property changes.
- Parameters:
- imp - The implementation returned by createImplementation.
- methods - The array of methods in the dippable
bean.
- Returns:
- The array of DipPropertyChangeListeners with the dip itself set to
listen at the appropriate method index to receive
property change notifications.
- Throws: DipRejectAdditionException
- This method will throw this
exception if some needed methods of the dippable bean were not wrapped.
- Overrides:
- createPropertyChangeListener in class SimpleDip
propertyChange
public void propertyChange(PropertyChangeEvent e)
- Handles a property change event. The connecting flight dip
will filter the results provided by the flight info property
and remove any flights that cost more than the threshold over
the cheapest connecting flight.
All Packages Class Hierarchy This Package Previous Next Index