// Path: src/main/java/pl/jalokim/propertiestojson/object/AbstractJsonType.java
// public abstract class AbstractJsonType {
// 
//     /**
//      * This one simply concatenate to rest of json. Simply speaking when will not converted then will not create whole json correctly.
//      *
//      * @return string for part of json.
//      */
//     public abstract String toStringJson();
// 
//     @Override
//     public final String toString() {
//         return toStringJson();
//     }
// }
// 
// Path: src/main/java/pl/jalokim/propertiestojson/object/NumberJsonType.java
// public class NumberJsonType extends PrimitiveJsonType<Number> {
// 
//     public NumberJsonType(Number value) {
//         super(value);
//     }
// }
// 
// Path: src/main/java/pl/jalokim/propertiestojson/resolvers/PrimitiveJsonTypesResolver.java
// public class PrimitiveJsonTypesResolver extends JsonTypeResolver {
// 
//     private final List<TextToConcreteObjectResolver<?>> toObjectsResolvers;
//     private final JsonTypeResolversHierarchyResolver resolversHierarchyResolver;
//     private final Boolean skipNulls;
//     private final NullToJsonTypeConverter nullToJsonTypeConverter;
// 
//     public PrimitiveJsonTypesResolver(List<TextToConcreteObjectResolver<?>> toObjectsResolvers,
//         List<ObjectToJsonTypeConverter<?>> toJsonResolvers,
//         Boolean skipNulls,
//         NullToJsonTypeConverter nullToJsonTypeConverter) {
//         this.toObjectsResolvers = ImmutableList.copyOf(toObjectsResolvers);
//         this.resolversHierarchyResolver = new JsonTypeResolversHierarchyResolver(toJsonResolvers);
//         this.skipNulls = skipNulls;
//         this.nullToJsonTypeConverter = nullToJsonTypeConverter;
//     }
// 
//     @Override
//     public ObjectJsonType traverse(PathMetadata currentPathMetaData) {
//         addPrimitiveFieldWhenIsValid(currentPathMetaData);
//         return null;
//     }
// 
//     private void addPrimitiveFieldWhenIsValid(PathMetadata currentPathMetaData) {
//         JsonObjectFieldsValidator.checkThatFieldCanBeSet(currentObjectJsonType, currentPathMetaData, propertyKey);
//         addPrimitiveFieldToCurrentJsonObject(currentPathMetaData);
//     }
// 
//     private void addPrimitiveFieldToCurrentJsonObject(PathMetadata currentPathMetaData) {
//         String field = currentPathMetaData.getFieldName();
//         if (currentPathMetaData.isArrayField()) {
//             addFieldToArray(currentPathMetaData);
//         } else {
//             if (currentObjectJsonType.containsField(field) && isArrayJson(currentObjectJsonType.getField(field))) {
//                 AbstractJsonType abstractJsonType = currentPathMetaData.getJsonValue();
//                 ArrayJsonType currentArrayInObject = currentObjectJsonType.getJsonArray(field);
//                 if (isArrayJson(abstractJsonType)) {
//                     ArrayJsonType newArray = (ArrayJsonType) abstractJsonType;
//                     List<AbstractJsonType> abstractJsonTypes = newArray.convertToListWithoutRealNull();
//                     for (int i = 0; i < abstractJsonTypes.size(); i++) {
//                         currentArrayInObject.addElement(i, abstractJsonTypes.get(i), currentPathMetaData);
//                     }
//                 } else {
//                     throw new CannotOverrideFieldException(currentPathMetaData.getCurrentFullPath(), currentArrayInObject, propertyKey);
//                 }
//             } else {
//                 currentObjectJsonType.addField(field, currentPathMetaData.getJsonValue(), currentPathMetaData);
//             }
//         }
//     }
// 
//     public Object getResolvedObject(String propertyValue, String propertyKey) {
//         Optional<?> objectOptional = Optional.empty();
//         for (TextToConcreteObjectResolver primitiveResolver : toObjectsResolvers) {
//             if (!objectOptional.isPresent()) {
//                 objectOptional = primitiveResolver.returnConvertedValueForClearedText(this, propertyValue, propertyKey);
//             }
//         }
//         return objectOptional.orElse(null);
//     }
// 
//     public AbstractJsonType resolvePrimitiveTypeAndReturn(Object propertyValue, String propertyKey) {
//         AbstractJsonType result;
//         if (propertyValue == null) {
//             result = nullToJsonTypeConverter.convertToJsonTypeOrEmpty(this, NULL_OBJECT, propertyKey).get();
//         } else {
//             result = resolversHierarchyResolver.returnConcreteJsonTypeObject(this, propertyValue, propertyKey);
//         }
// 
//         if (Boolean.TRUE.equals(skipNulls) && result instanceof JsonNullReferenceType) {
//             result = SkipJsonField.SKIP_JSON_FIELD;
//         }
// 
//         return result;
//     }
// 
//     protected void addFieldToArray(PathMetadata currentPathMetaData) {
//         if (arrayWithGivenFieldNameExist(currentPathMetaData.getFieldName())) {
//             fetchArrayAndAddElement(currentPathMetaData);
//         } else {
//             createArrayAndAddElement(currentPathMetaData);
//         }
//     }
// 
//     private boolean arrayWithGivenFieldNameExist(String field) {
//         return currentObjectJsonType.containsField(field);
//     }
// 
//     private void createArrayAndAddElement(PathMetadata currentPathMetaData) {
//         ArrayJsonType arrayJsonTypeObject = new ArrayJsonType();
//         addElementToArray(currentPathMetaData, arrayJsonTypeObject);
//         currentObjectJsonType.addField(currentPathMetaData.getFieldName(), arrayJsonTypeObject, currentPathMetaData);
//     }
// 
//     private void fetchArrayAndAddElement(PathMetadata currentPathMetaData) {
//         ArrayJsonType arrayJsonType = getArrayJsonWhenIsValid(currentPathMetaData);
//         addElementToArray(currentPathMetaData, arrayJsonType);
//     }
// 
//     private void addElementToArray(PathMetadata currentPathMetaData, ArrayJsonType arrayJsonTypeObject) {
//         arrayJsonTypeObject.addElement(currentPathMetaData.getPropertyArrayHelper(), currentPathMetaData.getJsonValue(), currentPathMetaData);
//     }
// 
// }


import java.util.Optional;
import pl.jalokim.propertiestojson.object.AbstractJsonType;
import pl.jalokim.propertiestojson.object.NumberJsonType;
import pl.jalokim.propertiestojson.resolvers.PrimitiveJsonTypesResolver;
package pl.jalokim.propertiestojson.resolvers.primitives.object;


public class NumberToJsonTypeConverter extends AbstractObjectToJsonTypeConverter<Number> {

    @Override
// Path: src/main/java/pl/jalokim/propertiestojson/object/AbstractJsonType.java
// public abstract class AbstractJsonType {
// 
//     /**
//      * This one simply concatenate to rest of json. Simply speaking when will not converted then will not create whole json correctly.
//      *
//      * @return string for part of json.
//      */
//     public abstract String toStringJson();
// 
//     @Override
//     public final String toString() {
//         return toStringJson();
//     }
// }
// 
// Path: src/main/java/pl/jalokim/propertiestojson/object/NumberJsonType.java
// public class NumberJsonType extends PrimitiveJsonType<Number> {
// 
//     public NumberJsonType(Number value) {
//         super(value);
//     }
// }
// 
// Path: src/main/java/pl/jalokim/propertiestojson/resolvers/PrimitiveJsonTypesResolver.java
// public class PrimitiveJsonTypesResolver extends JsonTypeResolver {
// 
//     private final List<TextToConcreteObjectResolver<?>> toObjectsResolvers;
//     private final JsonTypeResolversHierarchyResolver resolversHierarchyResolver;
//     private final Boolean skipNulls;
//     private final NullToJsonTypeConverter nullToJsonTypeConverter;
// 
//     public PrimitiveJsonTypesResolver(List<TextToConcreteObjectResolver<?>> toObjectsResolvers,
//         List<ObjectToJsonTypeConverter<?>> toJsonResolvers,
//         Boolean skipNulls,
//         NullToJsonTypeConverter nullToJsonTypeConverter) {
//         this.toObjectsResolvers = ImmutableList.copyOf(toObjectsResolvers);
//         this.resolversHierarchyResolver = new JsonTypeResolversHierarchyResolver(toJsonResolvers);
//         this.skipNulls = skipNulls;
//         this.nullToJsonTypeConverter = nullToJsonTypeConverter;
//     }
// 
//     @Override
//     public ObjectJsonType traverse(PathMetadata currentPathMetaData) {
//         addPrimitiveFieldWhenIsValid(currentPathMetaData);
//         return null;
//     }
// 
//     private void addPrimitiveFieldWhenIsValid(PathMetadata currentPathMetaData) {
//         JsonObjectFieldsValidator.checkThatFieldCanBeSet(currentObjectJsonType, currentPathMetaData, propertyKey);
//         addPrimitiveFieldToCurrentJsonObject(currentPathMetaData);
//     }
// 
//     private void addPrimitiveFieldToCurrentJsonObject(PathMetadata currentPathMetaData) {
//         String field = currentPathMetaData.getFieldName();
//         if (currentPathMetaData.isArrayField()) {
//             addFieldToArray(currentPathMetaData);
//         } else {
//             if (currentObjectJsonType.containsField(field) && isArrayJson(currentObjectJsonType.getField(field))) {
//                 AbstractJsonType abstractJsonType = currentPathMetaData.getJsonValue();
//                 ArrayJsonType currentArrayInObject = currentObjectJsonType.getJsonArray(field);
//                 if (isArrayJson(abstractJsonType)) {
//                     ArrayJsonType newArray = (ArrayJsonType) abstractJsonType;
//                     List<AbstractJsonType> abstractJsonTypes = newArray.convertToListWithoutRealNull();
//                     for (int i = 0; i < abstractJsonTypes.size(); i++) {
//                         currentArrayInObject.addElement(i, abstractJsonTypes.get(i), currentPathMetaData);
//                     }
//                 } else {
//                     throw new CannotOverrideFieldException(currentPathMetaData.getCurrentFullPath(), currentArrayInObject, propertyKey);
//                 }
//             } else {
//                 currentObjectJsonType.addField(field, currentPathMetaData.getJsonValue(), currentPathMetaData);
//             }
//         }
//     }
// 
//     public Object getResolvedObject(String propertyValue, String propertyKey) {
//         Optional<?> objectOptional = Optional.empty();
//         for (TextToConcreteObjectResolver primitiveResolver : toObjectsResolvers) {
//             if (!objectOptional.isPresent()) {
//                 objectOptional = primitiveResolver.returnConvertedValueForClearedText(this, propertyValue, propertyKey);
//             }
//         }
//         return objectOptional.orElse(null);
//     }
// 
//     public AbstractJsonType resolvePrimitiveTypeAndReturn(Object propertyValue, String propertyKey) {
//         AbstractJsonType result;
//         if (propertyValue == null) {
//             result = nullToJsonTypeConverter.convertToJsonTypeOrEmpty(this, NULL_OBJECT, propertyKey).get();
//         } else {
//             result = resolversHierarchyResolver.returnConcreteJsonTypeObject(this, propertyValue, propertyKey);
//         }
// 
//         if (Boolean.TRUE.equals(skipNulls) && result instanceof JsonNullReferenceType) {
//             result = SkipJsonField.SKIP_JSON_FIELD;
//         }
// 
//         return result;
//     }
// 
//     protected void addFieldToArray(PathMetadata currentPathMetaData) {
//         if (arrayWithGivenFieldNameExist(currentPathMetaData.getFieldName())) {
//             fetchArrayAndAddElement(currentPathMetaData);
//         } else {
//             createArrayAndAddElement(currentPathMetaData);
//         }
//     }
// 
//     private boolean arrayWithGivenFieldNameExist(String field) {
//         return currentObjectJsonType.containsField(field);
//     }
// 
//     private void createArrayAndAddElement(PathMetadata currentPathMetaData) {
//         ArrayJsonType arrayJsonTypeObject = new ArrayJsonType();
//         addElementToArray(currentPathMetaData, arrayJsonTypeObject);
//         currentObjectJsonType.addField(currentPathMetaData.getFieldName(), arrayJsonTypeObject, currentPathMetaData);
//     }
// 
//     private void fetchArrayAndAddElement(PathMetadata currentPathMetaData) {
//         ArrayJsonType arrayJsonType = getArrayJsonWhenIsValid(currentPathMetaData);
//         addElementToArray(currentPathMetaData, arrayJsonType);
//     }
// 
//     private void addElementToArray(PathMetadata currentPathMetaData, ArrayJsonType arrayJsonTypeObject) {
//         arrayJsonTypeObject.addElement(currentPathMetaData.getPropertyArrayHelper(), currentPathMetaData.getJsonValue(), currentPathMetaData);
//     }
// 
// }


// Path: src/main/java/pl/jalokim/propertiestojson/resolvers/primitives/object/NumberToJsonTypeConverter.java
import java.util.Optional;
import pl.jalokim.propertiestojson.object.AbstractJsonType;
import pl.jalokim.propertiestojson.object.NumberJsonType;
import pl.jalokim.propertiestojson.resolvers.PrimitiveJsonTypesResolver;

package pl.jalokim.propertiestojson.resolvers.primitives.object;


public class NumberToJsonTypeConverter extends AbstractObjectToJsonTypeConverter<Number> {

    @Override
    public Optional<AbstractJsonType> convertToJsonTypeOrEmpty(PrimitiveJsonTypesResolver primitiveJsonTypesResolver,