Exemplo n.º 1
0
  /**
   * Remove Java language specific properties from the given list of property descriptors.
   *
   * @param properties is the list of property descriptors
   */
  protected static void removeJavaProperties(List<InternalEventPropDescriptor> properties) {
    List<InternalEventPropDescriptor> toRemove = new LinkedList<InternalEventPropDescriptor>();

    // add removed entries to separate list
    for (InternalEventPropDescriptor desc : properties) {
      if ((desc.getPropertyName().equals("class"))
          || (desc.getPropertyName().equals("getClass"))
          || (desc.getPropertyName().equals("toString"))
          || (desc.getPropertyName().equals("hashCode"))) {
        toRemove.add(desc);
      }
    }

    // remove
    for (InternalEventPropDescriptor desc : toRemove) {
      properties.remove(desc);
    }
  }
Exemplo n.º 2
0
  /**
   * Removed duplicate properties using the property name to find unique properties.
   *
   * @param properties is a list of property descriptors
   */
  protected static void removeDuplicateProperties(List<InternalEventPropDescriptor> properties) {
    LinkedHashMap<String, InternalEventPropDescriptor> set =
        new LinkedHashMap<String, InternalEventPropDescriptor>();
    List<InternalEventPropDescriptor> toRemove = new LinkedList<InternalEventPropDescriptor>();

    // add duplicates to separate list
    for (InternalEventPropDescriptor desc : properties) {
      if (set.containsKey(desc.getPropertyName())) {
        toRemove.add(desc);
        continue;
      }
      set.put(desc.getPropertyName(), desc);
    }

    // remove duplicates
    for (InternalEventPropDescriptor desc : toRemove) {
      properties.remove(desc);
    }
  }