| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
|
| 5 | |
|
| 6 | |
|
| 7 | |
|
| 8 | |
|
| 9 | |
|
| 10 | |
|
| 11 | |
|
| 12 | |
|
| 13 | |
|
| 14 | |
|
| 15 | |
|
| 16 | |
package org.dozer.loader.api; |
| 17 | |
|
| 18 | |
import org.dozer.loader.DozerBuilder; |
| 19 | |
|
| 20 | |
|
| 21 | |
|
| 22 | |
|
| 23 | |
public class FieldDefinition { |
| 24 | |
|
| 25 | |
private String value; |
| 26 | |
|
| 27 | |
private Boolean accessible; |
| 28 | |
private String createMethod; |
| 29 | |
private String key; |
| 30 | |
private String mapGetMethod; |
| 31 | |
private String mapSetMethod; |
| 32 | |
private String getMethod; |
| 33 | |
private String setMethod; |
| 34 | |
private boolean iterate; |
| 35 | |
|
| 36 | 47 | public FieldDefinition(String value) { |
| 37 | 47 | this.value = value; |
| 38 | 47 | } |
| 39 | |
|
| 40 | |
public void build(DozerBuilder.FieldDefinitionBuilder builder) { |
| 41 | 46 | builder.accessible(this.accessible); |
| 42 | 46 | builder.createMethod(this.createMethod); |
| 43 | |
|
| 44 | 46 | builder.key(this.key); |
| 45 | 46 | builder.mapGetMethod(this.mapGetMethod); |
| 46 | 46 | builder.mapSetMethod(this.mapSetMethod); |
| 47 | |
|
| 48 | 46 | builder.theGetMethod(this.getMethod); |
| 49 | 46 | builder.theSetMethod(this.setMethod); |
| 50 | |
|
| 51 | 46 | if (this.iterate) { |
| 52 | 1 | builder.iterate(); |
| 53 | |
} |
| 54 | 46 | } |
| 55 | |
|
| 56 | |
public FieldDefinition iterate() { |
| 57 | 1 | this.iterate = true; |
| 58 | 1 | return this; |
| 59 | |
} |
| 60 | |
|
| 61 | |
public FieldDefinition accessible() { |
| 62 | 0 | return accessible(true); |
| 63 | |
} |
| 64 | |
|
| 65 | |
public FieldDefinition accessible(boolean value) { |
| 66 | 4 | this.accessible = value; |
| 67 | 4 | return this; |
| 68 | |
} |
| 69 | |
|
| 70 | |
public FieldDefinition createMethod(String method) { |
| 71 | 0 | this.createMethod = method; |
| 72 | 0 | return this; |
| 73 | |
} |
| 74 | |
|
| 75 | |
public FieldDefinition mapKey(String key) { |
| 76 | 2 | this.key = key; |
| 77 | 2 | return this; |
| 78 | |
} |
| 79 | |
|
| 80 | |
public FieldDefinition mapMethods(String getMethod, String setMethod) { |
| 81 | 2 | this.mapGetMethod = getMethod; |
| 82 | 2 | this.mapSetMethod = setMethod; |
| 83 | 2 | return this; |
| 84 | |
} |
| 85 | |
|
| 86 | |
public FieldDefinition getMethod(String getMethod) { |
| 87 | 0 | this.getMethod = getMethod; |
| 88 | 0 | return this; |
| 89 | |
} |
| 90 | |
|
| 91 | |
public FieldDefinition setMethod(String setMethod) { |
| 92 | 1 | this.setMethod = setMethod; |
| 93 | 1 | return this; |
| 94 | |
} |
| 95 | |
|
| 96 | |
String resolve() { |
| 97 | 48 | return value; |
| 98 | |
} |
| 99 | |
|
| 100 | |
} |