facet field -> list of facet field values
@param table gwt datatable as internal table data source
@param facetFields list of field to calculate facet values for
506596
private FacetList calculateFacetList(AbstractDataTable table, String[] facetFields) {
        if(facetFields == null || facetFields.length == 0){
             throw new NullPointerException("Facet field list empty");
        }
        FacetList facetList = new FacetList();
        for (String facetField : facetFields) {
            Set<String> distinctColumnValues = dataTableExtensions.getDistinctColumnValues(table, schema.getColumnIndex(facetField));
            facetList.addFacetField(facetField, distinctColumnValues);
        }
        return facetList;
    }
586924
public void scanForAnnotatedFields(Types typeUtils, Elements elementUtils)
      throws ProcessingException {

    // Scan inheritance hierarchy recursively to find all annotated fields
    TypeElement currentClass = typeElement;
    TypeMirror superClassType;
    Column annotation = null;
    PackageElement originPackage = elementUtils.getPackageOf(typeElement);
    PackageElement superClassPackage;

    Set<VariableElement> annotatedFields = new LinkedHashSet<>();
    Map<String, ExecutableElement> possibleSetterFields = new HashMap<>();


    do {

      // Scan fields
      for (Element e : currentClass.getEnclosedElements()) {
        annotation = e.getAnnotation(Column.class);
        if (e.getKind() == ElementKind.FIELD && annotation != null) {
          annotatedFields.add((VariableElement) e);
        }
        // Check methods
        else if (e.getKind() == ElementKind.METHOD) {

          // Save possible setters
          ExecutableElement methodElement = (ExecutableElement) e;
          String setterMethodName = methodElement.getSimpleName().toString();

          if (setterMethodName.startsWith("set")) {
            ExecutableElement existingSetter = possibleSetterFields.get(setterMethodName);
            if (existingSetter != null) {
              // The new setter has better visibility, so pick that one
              if (ModifierUtils.compareModifierVisibility(methodElement, existingSetter) == -1) {
                possibleSetterFields.put(setterMethodName, methodElement);
              }
            } else {
              possibleSetterFields.put(setterMethodName, methodElement);
            }
          }

          // Is it an annotated setter?
          if (annotation != null) {

            ColumnAnnotatedMethod method = new ColumnAnnotatedMethod(methodElement, annotation);

            ColumnAnnotateable existingColumnAnnotateable =
                columnAnnotatedElementsMap.get(method.getColumnName());
            if (existingColumnAnnotateable != null) {
              throw new ProcessingException(methodElement,
                  "The method %s in class %s is annotated with @%s with column name = \"%s\" but this column name is already used by %s in class %s",
                  method.getMethodName(), method.getQualifiedSurroundingClassName(),
                  Column.class.getSimpleName(), method.getColumnName(),
                  existingColumnAnnotateable.getElementName(),
                  existingColumnAnnotateable.getQualifiedSurroundingClassName());
            }

            columnAnnotatedElementsMap.put(method.getColumnName(), method);
          }
        } else if (annotation != null) {
          throw new ProcessingException(e,
              "%s is of type %s and annotated with @%s, but only Fields or setter Methods can be annotated with @%s",
              e.getSimpleName(), e.getKind().toString(), Column.class.getSimpleName(),
              Column.class.getSimpleName());
        }
      }

      superClassType = currentClass.getSuperclass();
      currentClass = (TypeElement) typeUtils.asElement(superClassType);
    } while (superClassType.getKind() != TypeKind.NONE);

    // Check fields
    for (VariableElement e : annotatedFields) {

      annotation = e.getAnnotation(Column.class);
      currentClass = (TypeElement) e.getEnclosingElement();

      if (e.getModifiers().contains(Modifier.PRIVATE)) {
        // Private field: Automatically try to detect a setter
        String fieldName = e.getSimpleName().toString();

        String perfectSetterName;
        if (fieldName.length() == 1) {
          perfectSetterName = "set" + fieldName.toUpperCase();
        } else {
          String withoutHungarianNotation = HungarianNotation.removeNotation(fieldName);
          perfectSetterName = "set"
              + Character.toUpperCase(withoutHungarianNotation.charAt(0))
              + withoutHungarianNotation.substring(1);
        }

        ExecutableElement setterMethod = possibleSetterFields.get(perfectSetterName);
        if (setterMethod != null && isSetterForField(setterMethod, e)) {
          // valid setter, so use this one
          ColumnAnnotatedMethod method = new ColumnAnnotatedMethod(setterMethod, annotation);
          columnAnnotatedElementsMap.put(method.getColumnName(), method);
          continue;
        } else {

          if (fieldName.startsWith("m")) {
            // setmFoo()  if field == mFoo
            setterMethod = possibleSetterFields.get("set" + fieldName);
            if (setterMethod != null && isSetterForField(setterMethod, e)) {
              // valid setter
              ColumnAnnotatedMethod method = new ColumnAnnotatedMethod(setterMethod, annotation);
              columnAnnotatedElementsMap.put(method.getColumnName(), method);
              continue;
            } else {
              // setMFoo  if field == mFoo
              if (fieldName.length() > 1) {
                setterMethod = possibleSetterFields.get(
                    "set" + Character.toUpperCase(fieldName.charAt(0)) + fieldName.substring(1));
                if (setterMethod != null && isSetterForField(setterMethod, e)) {
                  // valid setter
                  ColumnAnnotatedMethod method =
                      new ColumnAnnotatedMethod(setterMethod, annotation);
                  columnAnnotatedElementsMap.put(method.getColumnName(), method);
                  continue;
                }
              }
            }
          }
        }

         // Kotlin special boolean character treatment
        if (fieldName.matches("is[A-Z].*")) {
          String setterName = "set" + fieldName.substring(2);
          setterMethod = possibleSetterFields.get(setterName);
          if (setterMethod != null && isSetterForField(setterMethod, e)) {
            // valid setter
            ColumnAnnotatedMethod method =
                new ColumnAnnotatedMethod(setterMethod, annotation);
            columnAnnotatedElementsMap.put(method.getColumnName(), method);
            continue;
          }
        }

        throw new ProcessingException(e, "The field '%s' in class %s is private. "
            + "A corresponding setter method with the name '%s(%s)' is expected but haven't been found. Please add this setter method, "
            + "If you have another setter method named differently "
            + "please annotate your setter method with @%s ", fieldName,
            e.getEnclosingElement().getSimpleName().toString(), perfectSetterName,
            e.asType().toString(), Column.class.getSimpleName());
      } else {
        // A simple non private field
        ColumnAnnotatedField field = new ColumnAnnotatedField(e, annotation);

        // Check field visibility of super class field
        if (currentClass != typeElement && !field.getField()
            .getModifiers()
            .contains(Modifier.PUBLIC)) {

          superClassPackage = elementUtils.getPackageOf(currentClass);

          if ((superClassPackage != null && originPackage == null) || (superClassPackage == null
              && originPackage != null) || (superClassPackage != null && !superClassPackage.equals(
              originPackage)) || (originPackage != null && !originPackage.equals(
              superClassPackage))) {

            throw new ProcessingException(e,
                "The field %s in class %s can not be accessed from ObjectMapper because of "
                    + "visibility issue. Either move class %s into the same package "
                    + "as %s or make the field %s public or create and annotate a public setter "
                    + "method for this field with @%s instead of annotating the field itself",
                field.getFieldName(), field.getQualifiedSurroundingClassName(),
                typeElement.getQualifiedName().toString(), field.getQualifiedSurroundingClassName(),
                field.getFieldName(), Column.class.getSimpleName());
          }
        }

        ColumnAnnotateable existingColumnAnnotateable =
            columnAnnotatedElementsMap.get(field.getColumnName());
        if (existingColumnAnnotateable != null) {
          throw new ProcessingException(e,
              "The field %s in class %s is annotated with @%s with column name = \"%s\" but this column name is already used by %s in class %s",
              field.getFieldName(), field.getQualifiedSurroundingClassName(),
              Column.class.getSimpleName(), field.getColumnName(),
              existingColumnAnnotateable.getElementName(),
              existingColumnAnnotateable.getQualifiedSurroundingClassName());
        }

        columnAnnotatedElementsMap.put(field.getColumnName(), field);
      }
    }
  }
158595
@SuppressWarnings("unchecked")
	private static void computeAnyFieldDifferences(FieldNode oField, FieldNode nField, TypeDelta td) {
		// Want to record things that are different between these two fields...
		FieldDelta fd = new FieldDelta(oField.name);
		if (oField.access != nField.access) {
			// access changed
			fd.setAccessChanged(oField.access, nField.access);
		}
		if (!oField.desc.equals(nField.desc)) {
			// type changed
			fd.setTypeChanged(oField.desc, nField.desc);
		}
		String annotationChange = compareAnnotations(oField.invisibleAnnotations, nField.invisibleAnnotations);
		annotationChange = annotationChange + compareAnnotations(oField.visibleAnnotations, nField.visibleAnnotations);
		if (annotationChange.length() != 0) {
			fd.setAnnotationsChanged(annotationChange);
		}
		if (fd.hasAnyChanges()) {
			// it needs recording
			td.addChangedField(fd);
		}
	}
389199
@Override
    public Set<FacetRank> calculate(Collection<Facet> facets) {
        // calculate TF
        Set<FacetRank> facetsRank = facets.stream()
                                          .collect(Collectors.groupingBy(new GroupByFacetType()))
                                          .entrySet()
                                          .stream()
                                          .flatMap(facetTypeEntry -> {
                                              List<Facet> valuesByFacetType = facetTypeEntry.getValue();
                                              int termsByFacetType = valuesByFacetType.size();

                                              return valuesByFacetType.stream()
                                                                      .collect(Collectors.groupingBy(new GroupByFacet()))
                                                                      .entrySet()
                                                                      .stream()
                                                                      .flatMap(new CalculateTfFunction(termsByFacetType));
                                          })
                                          .collect(Collectors.toSet());

        return facetsRank;
    }
971059
def _do_multivalued_field_facets(self, results, field_facets):
        
        facet_dict = {}

        for field in field_facets:
            facet_list = {}
            if not self._multi_value_field(field):
                continue

            for result in results:
                field_value = getattr(result, field)
                for item in field_value:  # Facet each item in a MultiValueField
                    facet_list[item] = facet_list.get(item, 0) + 1

            facet_dict[field] = list(facet_list.items())
        return facet_dict
321957
private static <T> void readTableField(DatabaseTableConfig<T> config, String field, String value) {
		if (field.equals(FIELD_NAME_DATA_CLASS)) {
			try {
				@SuppressWarnings("unchecked")
				Class<T> clazz = (Class<T>) Class.forName(value);
				config.setDataClass(clazz);
			} catch (ClassNotFoundException e) {
				throw new IllegalArgumentException("Unknown class specified for dataClass: " + value);
			}
		} else if (field.equals(FIELD_NAME_TABLE_NAME)) {
			config.setTableName(value);
		}
	}
876354
@SuppressWarnings({ "rawtypes", "unchecked" }) // Using correct types, but wildcards fail to see that.
    private void processFields(final Object component, final Field[] fields, final Context context,
            final ContextDestroyer contextDestroyer) {
        for (final Field field : fields) {
            final com.badlogic.gdx.utils.reflect.Annotation[] annotations = getAnnotations(field);
            if (annotations == null || annotations.length == 0) {
                continue;
            }
            for (final com.badlogic.gdx.utils.reflect.Annotation annotation : annotations) {
                if (fieldProcessors.containsKey(annotation.getAnnotationType())) {
                    for (final AnnotationProcessor processor : fieldProcessors.get(annotation.getAnnotationType())) {
                        processor.processField(field, annotation.getAnnotation(annotation.getAnnotationType()),
                                component, context, this, contextDestroyer);
                    }
                }
            }
        }
    }
474009
protected void setValueToField(Field field, Object bean, Object value) {
        try {
            field.setAccessible(true);
            field.set(bean, value);
        } catch (Exception e) {
            throw new PropertyLoaderException(
                    String.format("Can not set bean <%s> field <%s> value", bean, field), e
            );
        }
    }
633849
public void removeRelationshipsWithMappingTable(String mappingTable) {
		try {
			if (extendedRelationsDao.isTableExists()) {
				List<ExtendedRelation> extendedRelations = getRelations(null,
						null, mappingTable);
				for (ExtendedRelation extendedRelation : extendedRelations) {
					removeRelationship(extendedRelation);
				}
			}
		} catch (SQLException e) {
			throw new GeoPackageException(
					"Failed to remove relationships for mapping table: "
							+ mappingTable, e);
		}
	}
274992
private void getFields(ArrayList<JField> fieldList)
  {
    for (JField field : getDeclaredFields()) {
      if (! fieldList.contains(field))
        fieldList.add(field);
    }

    if (getSuperClass() != null) {
      for (JField field : getSuperClass().getFields()) {
        if (! fieldList.contains(field))
          fieldList.add(field);
      }
    }
  }
821780
@Override
	public void addField(final SchemaField field) {

		if (field instanceof FieldDefinition) {
			addField((FieldDefinition) field);
		} else if (field instanceof CopyFieldDefinition) {
			addCopyField((CopyFieldDefinition) field);
		}
	}
617320
@Override
   protected StaticXmlWidget createDataTableComponent(String elementName, Map<String, String> attributes,
            StaticXmlMetawidget metawidget)
   {
      // Create the normal table

      StaticXmlWidget dataTable = super.createDataTableComponent(elementName, attributes, metawidget);
      dataTable.putAttribute("styleClass", "data-table");

      // Process the binding and id early, so we can use them below

      StandardBindingProcessor bindingProcessor = metawidget.getWidgetProcessor(StandardBindingProcessor.class);

      if (bindingProcessor != null)
      {
         bindingProcessor.processWidget(dataTable, elementName, attributes, (StaticUIMetawidget) metawidget);
      }

      ReadableIdProcessor readableIdProcessor = metawidget.getWidgetProcessor(ReadableIdProcessor.class);

      if (readableIdProcessor != null)
      {
         readableIdProcessor.processWidget(dataTable, elementName, attributes, metawidget);
      }

      ValueHolder valueHolderTable = (ValueHolder) dataTable;
      String tableValueExpression = valueHolderTable.getValue();

      // Special support for non-Lists

      Class<?> clazz = WidgetBuilderUtils.getActualClassOrType(attributes, null);

      if (!List.class.isAssignableFrom(clazz))
      {
         String asListValueExpression = "forgeview:asList(" + StaticFacesUtils.unwrapExpression(tableValueExpression)
                  + ")";
         valueHolderTable.setValue(StaticFacesUtils.wrapExpression(asListValueExpression));
         ((BaseStaticXmlWidget) dataTable).putAdditionalNamespaceURI("forgeview", "http://jboss.org/forge/view");
      }

      // Add row creation/deletion for OneToMany and ManyToMany

      if (!TRUE.equals(attributes.get(N_TO_MANY)) || metawidget.isReadOnly())
      {
         return dataTable;
      }

      String componentType = WidgetBuilderUtils.getComponentType(attributes);

      if (componentType == null)
      {
         return dataTable;
      }

      // Hack until https://issues.apache.org/jira/browse/MYFACES-3410 is resolved: move the Collection into a temporary
      // variable

      HtmlPanelGroup panelGroup = new HtmlPanelGroup();

      FaceletsParam param = new FaceletsParam();
      param.putAttribute("name", COLLECTION_VAR);
      param.putAttribute("value", tableValueExpression);
      panelGroup.getChildren().add(param);

      // Special support for non-Lists

      if (!List.class.isAssignableFrom(clazz))
      {
         valueHolderTable.setValue(StaticFacesUtils.wrapExpression("forgeview:asList(" + COLLECTION_VAR + ")"));
      }
      else
      {
         valueHolderTable.setValue(StaticFacesUtils.wrapExpression(COLLECTION_VAR));
      }

      panelGroup.getChildren().add(dataTable);

      // If not bidirectional, create an 'Add' section (bidirectional does it 'in place')

      if (!attributes.containsKey(INVERSE_RELATIONSHIP))
      {
         HtmlPanelGrid panelGrid = new HtmlPanelGrid();
         panelGrid.putAttribute("styleClass", "data-table-footer");
         panelGrid.putAttribute("columns", "2");
         panelGrid.putAttribute("columnClasses", ",remove-column");

         // Select menu at bottom

         HtmlSelectOneMenu select = new HtmlSelectOneMenu();
         String selectId = dataTable.getAttribute("id") + "Select";
         select.putAttribute("id", selectId);
         String requestScopedValue = "requestScope['" + selectId + "']";
         select.setValue(StaticFacesUtils.wrapExpression(requestScopedValue));
         String simpleComponentType = ClassUtils.getSimpleName(componentType);
         String controllerName = StringUtils.decapitalize(simpleComponentType);
         select.setConverter(StaticFacesUtils.wrapExpression(controllerName + "Bean.converter"));
         addSelectItems(select, StaticFacesUtils.wrapExpression(controllerName + "Bean.all"), attributes);
         panelGrid.getChildren().add(select);

         // Create 'Add' button

         HtmlCommandLink addLink = new HtmlCommandLink();
         addLink.putAttribute("styleClass", "add-button");
         String addExpression = COLLECTION_VAR + ".add(" + requestScopedValue + ")";
         addLink.putAttribute("action", StaticFacesUtils.wrapExpression(addExpression));
         addLink.putAttribute("onclick", "if (document.getElementById(document.forms[0].id+':" + selectId
                  + "').selectedIndex &lt; 1) { alert('Must select a " + StringUtils.uncamelCase(simpleComponentType)
                  + "'); return false; }");

         // (id is useful for unit tests)

         addLink.putAttribute("id", dataTable.getAttribute("id") + "Add");
         panelGrid.getChildren().add(addLink);

         panelGroup.getChildren().add(panelGrid);
      }

      return panelGroup;
   }
431894
public void processUserDefinedFields(List<Row> fields, List<Row> values)
   {
      // Process fields
      Map<Integer, String> tableNameMap = new HashMap<Integer, String>();
      for (Row row : fields)
      {
         Integer fieldId = row.getInteger("udf_type_id");
         String tableName = row.getString("table_name");
         tableNameMap.put(fieldId, tableName);

         FieldTypeClass fieldType = FIELD_TYPE_MAP.get(tableName);
         if (fieldType != null)
         {
            String fieldDataType = row.getString("logical_data_type");
            String fieldName = row.getString("udf_type_label");

            m_udfFields.put(fieldId, fieldName);
            addUserDefinedField(fieldType, UserFieldDataType.valueOf(fieldDataType), fieldName);
         }
      }

      // Process values
      for (Row row : values)
      {
         Integer typeID = row.getInteger("udf_type_id");
         String tableName = tableNameMap.get(typeID);
         Map<Integer, List<Row>> tableData = m_udfValues.get(tableName);
         if (tableData == null)
         {
            tableData = new HashMap<Integer, List<Row>>();
            m_udfValues.put(tableName, tableData);
         }

         Integer id = row.getInteger("fk_id");
         List<Row> list = tableData.get(id);
         if (list == null)
         {
            list = new ArrayList<Row>();
            tableData.put(id, list);
         }
         list.add(row);
      }
   }
356348
protected I_CmsSearchConfigurationFacetField parseFieldFacet(JSONObject fieldFacetObject) {

        try {
            String field = fieldFacetObject.getString(JSON_KEY_FACET_FIELD);
            String name = parseOptionalStringValue(fieldFacetObject, JSON_KEY_FACET_NAME);
            String label = parseOptionalStringValue(fieldFacetObject, JSON_KEY_FACET_LABEL);
            Integer minCount = parseOptionalIntValue(fieldFacetObject, JSON_KEY_FACET_MINCOUNT);
            Integer limit = parseOptionalIntValue(fieldFacetObject, JSON_KEY_FACET_LIMIT);
            String prefix = parseOptionalStringValue(fieldFacetObject, JSON_KEY_FACET_PREFIX);
            String sorder = parseOptionalStringValue(fieldFacetObject, JSON_KEY_FACET_ORDER);
            I_CmsSearchConfigurationFacet.SortOrder order;
            try {
                order = I_CmsSearchConfigurationFacet.SortOrder.valueOf(sorder);
            } catch (Exception e) {
                order = null;
            }
            String filterQueryModifier = parseOptionalStringValue(fieldFacetObject, JSON_KEY_FACET_FILTERQUERYMODIFIER);
            Boolean isAndFacet = parseOptionalBooleanValue(fieldFacetObject, JSON_KEY_FACET_ISANDFACET);
            List<String> preselection = parseOptionalStringValues(fieldFacetObject, JSON_KEY_FACET_PRESELECTION);
            Boolean ignoreFilterAllFacetFilters = parseOptionalBooleanValue(
                fieldFacetObject,
                JSON_KEY_FACET_IGNOREALLFACETFILTERS);
            return new CmsSearchConfigurationFacetField(
                field,
                name,
                minCount,
                limit,
                prefix,
                label,
                order,
                filterQueryModifier,
                isAndFacet,
                preselection,
                ignoreFilterAllFacetFilters);
        } catch (JSONException e) {
            LOG.error(
                Messages.get().getBundle().key(Messages.ERR_FIELD_FACET_MANDATORY_KEY_MISSING_1, JSON_KEY_FACET_FIELD),
                e);
            return null;
        }
    }
835341
public Set<Member> getFieldUsage(Field field) {
        return getMembersFromDescriptors(store.get(index(MemberUsageScanner.class), name(field)));
    }
1009823
public Cells getValueCells(String table) {
        Cells res = new Cells(table);
        for (Cell cell : getCellsByTable(table)) {
            if (!cell.isKey()) {
                res.add(table, cell);
            }
        }

        return res;
    }
286875
public void addTableField(String fieldLabel, JTable field, List<JButton> buttons) {
		validateNotTabbed();
		JScrollPane scrollPane = new JScrollPane();
		scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
		scrollPane.setViewportView(field);
		field.setFillsViewportHeight(true);
		
		// Tables are a special case - they don't have labels and are accessed via the model
		if (this.fieldList.contains(field)) {
			throw new IllegalArgumentException("Field already added: " + field);
		}
		
		if (buttons == null || buttons.size() == 0) {
			if (fieldLabel == null) {
				this.getMainPanel().add(scrollPane,
						LayoutHelper.getGBC(1, this.fieldList.size(), 1, fieldWeight, 1.0D, 
								GridBagConstraints.BOTH, new Insets(4,4,4,4)));
			} else {
				this.addField(fieldLabel, field, scrollPane, 1.0D);
			}
		} else {
			JPanel tablePanel = new JPanel();
			tablePanel.setLayout(new GridBagLayout());
			tablePanel.add(scrollPane,
					LayoutHelper.getGBC(0, 0, 1, 1.0D, 1.0D, GridBagConstraints.BOTH, new Insets(4,4,4,4)));

			JPanel buttonPanel = new JPanel();
			buttonPanel.setLayout(new GridBagLayout());
			int buttonId = 0;
			for (JButton button : buttons) {
				buttonPanel.add(button,
						LayoutHelper.getGBC(0, buttonId++, 1, 0D, 0D, GridBagConstraints.BOTH, new Insets(2,2,2,2)));
			}
			// Add spacer to force buttons to the top
			buttonPanel.add(new JLabel(),
					LayoutHelper.getGBC(0, buttonId++, 1, 0D, 1.0D, GridBagConstraints.BOTH, new Insets(2,2,2,2)));
			
			tablePanel.add(buttonPanel,
					LayoutHelper.getGBC(1, 0, 1, 0D, 0D, GridBagConstraints.BOTH, new Insets(2,2,2,2)));

			if (fieldLabel == null) {
				this.getMainPanel().add(tablePanel,
						LayoutHelper.getGBC(1, this.fieldList.size(), 1, fieldWeight, 1.0D, 
								GridBagConstraints.BOTH, new Insets(4,4,4,4)));
			} else {
				this.addField(fieldLabel, field, tablePanel, 1.0D);
			}
		}
		this.fieldList.add(field);
	}