2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.cdm
.common
;
12 import org
.apache
.logging
.log4j
.LogManager
;
13 import org
.apache
.logging
.log4j
.Logger
;
16 * Wrapps a result object so it can be used as method parameter and changed within the method.
17 * This is useful especially for simple data types like <code>Boolean</code> etc.<br>
18 * Example (usage):<br><code>
19 * public String myMethod(String oneParameter, ResultWrapper<Boolean> success){<br>
20 * __if (oneParameter.equals("foo")){<br>
21 * ____success = success.setValue(false);<br>
22 * ____return "Foo";<br>
24 * ____//don't change success<br>
25 * ____return "All the best";<br>
29 * Here a String is returned but the boolean value may also be changed and it's value is useable
30 * by the calling method
35 public class ResultWrapper
<T
> {
37 private static final Logger logger
= LogManager
.getLogger();
39 public static final ResultWrapper
<Boolean
> NewInstance(Boolean value
){
40 ResultWrapper
<Boolean
> result
= new ResultWrapper
<Boolean
>();
41 result
.setValue(value
);
42 if (logger
.isDebugEnabled()){logger
.debug("New Instance");}
52 public void setValue(T value
) {