| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.dozer.classmap; |
| 17 | |
|
| 18 | |
import org.apache.commons.lang3.StringUtils; |
| 19 | |
|
| 20 | |
|
| 21 | |
|
| 22 | |
|
| 23 | 2 | public final class MappingDirection { |
| 24 | |
|
| 25 | |
private static final String BI_DIRECTIONAL_VALUE = "bi-directional"; |
| 26 | |
private static final String ONE_WAY_VALUE = "one-way"; |
| 27 | |
|
| 28 | |
|
| 29 | |
|
| 30 | |
|
| 31 | 1 | public static final MappingDirection BI_DIRECTIONAL = new MappingDirection(); |
| 32 | |
|
| 33 | |
|
| 34 | |
|
| 35 | 1 | public static final MappingDirection ONE_WAY = new MappingDirection(); |
| 36 | |
|
| 37 | |
public static MappingDirection valueOf(String mappingDirection) { |
| 38 | 1671 | if (BI_DIRECTIONAL_VALUE.equals(mappingDirection)) { |
| 39 | 829 | return BI_DIRECTIONAL; |
| 40 | 842 | } else if (ONE_WAY_VALUE.equals(mappingDirection)) { |
| 41 | 841 | return ONE_WAY; |
| 42 | 1 | } else if (StringUtils.isEmpty(mappingDirection)) { |
| 43 | 1 | return null; |
| 44 | |
} |
| 45 | 0 | throw new IllegalStateException("type should be bi-directional or one-way. " + mappingDirection); |
| 46 | |
} |
| 47 | |
|
| 48 | |
} |