1818
1919public class MultifieldAddonHandler implements DataSourceHandler {
2020
21- private static final String PLACEHOLDER_NAME = "_an_improbable_placeholder_name " ;
21+ private static final String PLACEHOLDER = DefaultObjectGenerationHandler . RESERVED_FIELD_NAME_PREFIX + "multifield " ;
2222 private static final float DEFAULT_CHANCE_OF_CHILD_FIELD = 0.5f ;
2323 private final Map <FieldType , List <FieldType >> subfieldTypes ;
2424 private final float chanceOfChildField ;
@@ -47,7 +47,7 @@ public DataSourceResponse.LeafMappingParametersGenerator handle(DataSourceReques
4747
4848 // Need to delegate creation of the same type of field to other handlers. So skip request
4949 // if it's for the placeholder name used when creating the child and parent fields.
50- if (request .fieldName ().equals (PLACEHOLDER_NAME )) {
50+ if (request .fieldName ().equals (PLACEHOLDER )) {
5151 return null ;
5252 }
5353
@@ -76,9 +76,7 @@ public DataSourceResponse.LeafMappingParametersGenerator handle(DataSourceReques
7676
7777 private static Map <String , Object > getChildMappingForType (FieldType type , DataSourceRequest .LeafMappingParametersGenerator request ) {
7878 Map <String , Object > mapping = getMappingForType (type , request );
79- if (type == FieldType .KEYWORD ) {
80- mapping .remove ("copy_to" );
81- }
79+ mapping .remove ("copy_to" );
8280 return mapping ;
8381 }
8482
@@ -87,7 +85,7 @@ private static Map<String, Object> getMappingForType(FieldType type, DataSourceR
8785 .get (
8886 new DataSourceRequest .LeafMappingParametersGenerator (
8987 request .dataSource (),
90- PLACEHOLDER_NAME ,
88+ PLACEHOLDER ,
9189 type .toString (),
9290 request .eligibleCopyToFields (),
9391 request .dynamicMapping ()
0 commit comments