Package com.senseidb.indexing

Examples of com.senseidb.indexing.MetaType


        if(type == null)
          throw new IllegalArgumentException("need to specify the type of field in filter json: " + json);
       
        if ("int".equals(type)) {
          MetaType metaType = DefaultSenseiInterpreter.CLASS_METATYPE_MAP.get(int.class);
          String formatString = DefaultSenseiInterpreter.DEFAULT_FORMAT_STRING_MAP.get(metaType);
          DecimalFormat formatter = new DecimalFormat(formatString, new DecimalFormatSymbols(Locale.US));
          fromPadded = formatter.format(Integer.parseInt(from));
          toPadded = formatter.format(Integer.parseInt(to));
        }
        else if ("short".equals(type)) {
          MetaType metaType = DefaultSenseiInterpreter.CLASS_METATYPE_MAP.get(short.class);
          String formatString = DefaultSenseiInterpreter.DEFAULT_FORMAT_STRING_MAP.get(metaType);
          DecimalFormat formatter = new DecimalFormat(formatString, new DecimalFormatSymbols(Locale.US));
          fromPadded = formatter.format(Short.parseShort(from));
          toPadded = formatter.format(Short.parseShort(to));
        }
        else if ("long".equals(type)) {
          MetaType metaType = DefaultSenseiInterpreter.CLASS_METATYPE_MAP.get(long.class);
          String formatString = DefaultSenseiInterpreter.DEFAULT_FORMAT_STRING_MAP.get(metaType);
          DecimalFormat formatter = new DecimalFormat(formatString, new DecimalFormatSymbols(Locale.US));
          fromPadded = formatter.format(Long.parseLong(from));
          toPadded = formatter.format(Long.parseLong(to));
        }
        else if ("date".equals(type)) {
          if(dateFormat == null)
            throw new IllegalArgumentException("Date format cannot be empty in filter json when type is date: " + json);
          else{
            SimpleDateFormat  formatter = new SimpleDateFormat(dateFormat);
            fromPadded = formatter.format(new Date(Long.parseLong(from)));
            toPadded = formatter.format(new Date(Long.parseLong(to)));
          }
        }
        else if ("float".equals(type)) {
          MetaType metaType = DefaultSenseiInterpreter.CLASS_METATYPE_MAP.get(float.class);
          String formatString = DefaultSenseiInterpreter.DEFAULT_FORMAT_STRING_MAP.get(metaType);
          DecimalFormat formatter = new DecimalFormat(formatString, new DecimalFormatSymbols(Locale.US));
          fromPadded = formatter.format(Float.parseFloat(from));
          toPadded = formatter.format(Float.parseFloat(to));
        }
        else if ("double".equals(type)) {
          MetaType metaType = DefaultSenseiInterpreter.CLASS_METATYPE_MAP.get(double.class);
          String formatString = DefaultSenseiInterpreter.DEFAULT_FORMAT_STRING_MAP.get(metaType);
          DecimalFormat formatter = new DecimalFormat(formatString, new DecimalFormatSymbols(Locale.US));
          fromPadded = formatter.format(Double.parseDouble(from));
          toPadded = formatter.format(Double.parseDouble(to));
        }
View Full Code Here


                }

                schema._fieldDefMap.put(n, fdef);

                if (t.equals("int")) {
                    MetaType metaType = DefaultSenseiInterpreter.CLASS_METATYPE_MAP.get(int.class);
                    String formatString = DefaultSenseiInterpreter.DEFAULT_FORMAT_STRING_MAP.get(metaType);
                    fdef.formatter = new DecimalFormat(formatString, new DecimalFormatSymbols(Locale.US));
                    fdef.type = int.class;
                } else if (t.equals("short")) {
                    MetaType metaType = DefaultSenseiInterpreter.CLASS_METATYPE_MAP.get(short.class);
                    String formatString = DefaultSenseiInterpreter.DEFAULT_FORMAT_STRING_MAP.get(metaType);
                    fdef.formatter = new DecimalFormat(formatString, new DecimalFormatSymbols(Locale.US));
                    fdef.type = int.class;
                } else if (t.equals("long")) {
                    MetaType metaType = DefaultSenseiInterpreter.CLASS_METATYPE_MAP.get(long.class);
                    String formatString = DefaultSenseiInterpreter.DEFAULT_FORMAT_STRING_MAP.get(metaType);
                    fdef.formatter = new DecimalFormat(formatString, new DecimalFormatSymbols(Locale.US));
                    fdef.type = long.class;
                } else if (t.equals("float")) {
                    MetaType metaType = DefaultSenseiInterpreter.CLASS_METATYPE_MAP.get(float.class);
                    String formatString = DefaultSenseiInterpreter.DEFAULT_FORMAT_STRING_MAP.get(metaType);
                    fdef.formatter = new DecimalFormat(formatString, new DecimalFormatSymbols(Locale.US));
                    fdef.type = double.class;
                } else if (t.equals("double")) {
                    MetaType metaType = DefaultSenseiInterpreter.CLASS_METATYPE_MAP.get(double.class);
                    String formatString = DefaultSenseiInterpreter.DEFAULT_FORMAT_STRING_MAP.get(metaType);
                    fdef.formatter = new DecimalFormat(formatString, new DecimalFormatSymbols(Locale.US));
                    fdef.type = double.class;
                } else if (t.equals("char")) {
                    fdef.formatter = null;
                } else if (t.equals("string")) {
                    fdef.formatter = null;
                } else if (t.equals("boolean")) {
                    MetaType metaType = DefaultSenseiInterpreter.CLASS_METATYPE_MAP.get(boolean.class);
                    String formatString = DefaultSenseiInterpreter.DEFAULT_FORMAT_STRING_MAP.get(metaType);

                    fdef.type = boolean.class;
                } else if (t.equals("date")) {
View Full Code Here

                }

                schema._fieldDefMap.put(n, fdef);

                if (t.equals("int")) {
                    MetaType metaType = DefaultSenseiInterpreter.CLASS_METATYPE_MAP.get(int.class);
                    String formatString = DefaultSenseiInterpreter.DEFAULT_FORMAT_STRING_MAP.get(metaType);
                    fdef.formatter = new DecimalFormat(formatString, new DecimalFormatSymbols(Locale.US));
                    fdef.type = int.class;
                } else if (t.equals("short")) {
                    MetaType metaType = DefaultSenseiInterpreter.CLASS_METATYPE_MAP.get(short.class);
                    String formatString = DefaultSenseiInterpreter.DEFAULT_FORMAT_STRING_MAP.get(metaType);
                    fdef.formatter = new DecimalFormat(formatString, new DecimalFormatSymbols(Locale.US));
                    fdef.type = int.class;
                } else if (t.equals("long")) {
                    MetaType metaType = DefaultSenseiInterpreter.CLASS_METATYPE_MAP.get(long.class);
                    String formatString = DefaultSenseiInterpreter.DEFAULT_FORMAT_STRING_MAP.get(metaType);
                    fdef.formatter = new DecimalFormat(formatString, new DecimalFormatSymbols(Locale.US));
                    fdef.type = long.class;
                } else if (t.equals("float")) {
                    MetaType metaType = DefaultSenseiInterpreter.CLASS_METATYPE_MAP.get(float.class);
                    String formatString = DefaultSenseiInterpreter.DEFAULT_FORMAT_STRING_MAP.get(metaType);
                    fdef.formatter = new DecimalFormat(formatString, new DecimalFormatSymbols(Locale.US));
                    fdef.type = double.class;
                } else if (t.equals("double")) {
                    MetaType metaType = DefaultSenseiInterpreter.CLASS_METATYPE_MAP.get(double.class);
                    String formatString = DefaultSenseiInterpreter.DEFAULT_FORMAT_STRING_MAP.get(metaType);
                    fdef.formatter = new DecimalFormat(formatString, new DecimalFormatSymbols(Locale.US));
                    fdef.type = double.class;
                } else if (t.equals("char")) {
                    fdef.formatter = null;
View Full Code Here

  {
    String[] facetInfo = facetInfoMap == null ? null : facetInfoMap.get(facet);
    if (facetInfo != null &&
        ("simple".equals(facetInfo[0]) || "multi".equals(facetInfo[0])))
    {
      MetaType metaType = null;
      String formatString = null;
      DecimalFormat formatter = null;
      String type = facetInfo[1];

      if ("int".equals(type))
View Full Code Here

TOP

Related Classes of com.senseidb.indexing.MetaType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.