Package com.complexible.common.view
Interface View<Input,Output>
-
- All Known Subinterfaces:
AdminConnectionView<Input,Output>
,ConnectionView<I,O>
public interface View<Input,Output>
Function which supports a polymorphic view of one class as another
- Since:
- 2.2
- Version:
- 2.2
- Author:
- Michael Grove
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
View.ViewException
Exception to indicate the reason aview
failed.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Output
as(Input theV)
Transform the object into the new view.boolean
canView(Input theInput, java.lang.Class<Output> theView)
Return whether or not the provided type of object can be viewed as the desired type.
-
-
-
Method Detail
-
as
Output as(Input theV) throws View.ViewException
Transform the object into the new view.- Parameters:
theV
- the object to change- Returns:
- the view of the object
- Throws:
View.ViewException
- if there was an error changing the view of the object.
-
canView
boolean canView(Input theInput, java.lang.Class<Output> theView)
Return whether or not the provided type of object can be viewed as the desired type. If true, calls toas(Input)
will always succeed.- Parameters:
theInput
- the type of the object whose view is to be changedtheView
- the type of view we want.- Returns:
- true if the object can be viewed as the view class, false otherwise.
-
-