public class VariableFactory extends Object
SolutionBuilder.Variables from usual
situations.| Modifier and Type | Class and Description |
|---|---|
static class |
VariableFactory.IsInterfaceException |
| Constructor and Description |
|---|
VariableFactory() |
| Modifier and Type | Method and Description |
|---|---|
<Solution> Collection<SolutionBuilder.Variable<Solution,?>> |
createFromGetters(Class<Solution> solutionClass)
This method retrieves all the values accessible through a getter (
getX() method) in order to build the corresponding set of
SolutionBuilder.Variables. |
<Solution> Collection<SolutionBuilder.Variable<Solution,?>> |
createFromGettersAndConstructors(Class<Solution> solutionClass)
This method retrieves all the values accessible through a getter (
getX() method) in order to build the corresponding set of
SolutionBuilder.Variables. |
<Solution> Collection<SolutionBuilder.Variable<Solution,?>> |
createFromGettersAndSetters(Class<Solution> solutionClass)
This method retrieves all the values accessible through a getter (
getX() method) in order to build the corresponding set of
SolutionBuilder.Variables. |
public <Solution> Collection<SolutionBuilder.Variable<Solution,?>> createFromGetters(Class<Solution> solutionClass)
getX() method) in order to build the corresponding set of
SolutionBuilder.Variables. Notice that SolutionBuilder.Variables are supposed to
represent the fundamental description of a Solution, so if the
Solution has computation or other additional methods which are
named as getters, they will also be retrieved as SolutionBuilder.Variables. In
such a case, you should filter the returned SolutionBuilder.Variables, rely on
more advanced methods, or generate the SolutionBuilder.Variables manually.solutionClass - the Solution class to analyzeSolutionBuilder.Variables retrieved from this classcreateFromGettersAndSetters(Class),
createFromGettersAndConstructors(Class)public <Solution> Collection<SolutionBuilder.Variable<Solution,?>> createFromGettersAndSetters(Class<Solution> solutionClass)
getX() method) in order to build the corresponding set of
SolutionBuilder.Variables. At the opposite of createFromGetters(Class),
an additional filter is used: we build a SolutionBuilder.Variable for each getter
which corresponds to a setter (setX() method with the same
X than the getter). This method is adapted for dynamic
Solution implementations, thus allowing to change the value of
its SolutionBuilder.Variables (e.g. change the path of a TSP Solution).SolutionBuilder.Variables will not be retrieved. On the opposite, any additional
setter/getter couple which does not correspond to a relevant
SolutionBuilder.Variable will be mistakenly retrieved. So be sure that the
relevant elements (and only these ones) have their setter and getter.
Otherwise, you should use a different method or generate the
SolutionBuilder.Variables manually.solutionClass - the Solution class to analyzeSolutionBuilder.Variables retrieved from this classpublic <Solution> Collection<SolutionBuilder.Variable<Solution,?>> createFromGettersAndConstructors(Class<Solution> solutionClass)
getX() method) in order to build the corresponding set of
SolutionBuilder.Variables. At the opposite of createFromGetters(Class),
an additional filter is used: we build a SolutionBuilder.Variable for each getter
which corresponds to a constructor argument (argument of the same type).
This method is adapted for static Solution implementations, which
usually have a constructor which takes all the relevant values and
provide getters to retrieve them.solutionClass - the Solution class to analyzeSolutionBuilder.Variables retrieved from this classIllegalArgumentException - if one of the constraints is not metVariableFactory.IsInterfaceException - if the Solution class to analyze is an interface,
thus constructors make no senseCopyright © 2017. All rights reserved.