Java Null Value Convert convertNullToSolrValue(String fieldName)

Here you can find the source of convertNullToSolrValue(String fieldName)

Description

convert Null To Solr Value

License

BSD License

Declaration

public static Object convertNullToSolrValue(String fieldName) 

Method Source Code

//package com.java2s;
//License from project: BSD License 

public class Main {
    public static Object convertNullToSolrValue(String fieldName) {
        Object convertedFieldValue = null;
        if (isSingleValueStringOrText(fieldName)) {
            convertedFieldValue = null;//w  w  w .  j a  v a  2s .co  m
        } else if (fieldName.endsWith("_dt") || fieldName.endsWith("_da")) {
            convertedFieldValue = null;
        } else if (fieldName.endsWith("_d")) {
            convertedFieldValue = null;
        } else if (isMultiValueStringOrText(fieldName)) {
            convertedFieldValue = null;
        } else if (fieldName.endsWith("_dts") || fieldName.endsWith("_das")) {
            convertedFieldValue = null;
        } else if (fieldName.endsWith("_ds")) {
            convertedFieldValue = null;
        }
        return convertedFieldValue;
    }

    public static boolean isSingleValueStringOrText(String fieldName) {
        return fieldName.endsWith("_s") || fieldName.endsWith("_t");
    }

    public static boolean isMultiValueStringOrText(String fieldName) {
        return fieldName.endsWith("_ss") || fieldName.endsWith("_txt");
    }
}

Related

  1. convertNullToEmptyString(String value)
  2. convertNullToFalse(Boolean b)
  3. convertNullToInteger(Object orgStr, int convertStr)
  4. convertNullToLong(Object orgStr, Long convertStr)
  5. convertNullToOne(final Object value)
  6. convertNullToString(final String str)
  7. convertNullValue(final Class convertType)
  8. null2blank(String prnStr)
  9. null2blank(String source)