congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
Properties.keepOnly
Code IndexAdd Tabnine to your IDE (free)

How to use
keepOnly
method
in
uk.gov.gchq.gaffer.data.element.Properties

Best Java code snippets using uk.gov.gchq.gaffer.data.element.Properties.keepOnly (Showing top 5 results out of 315)

origin: gchq/Gaffer

@Override
public void keepOnly(final Collection<String> propertiesToKeep) {
  properties.keepOnly(propertiesToKeep);
  loadedProperties.removeIf(s -> !propertiesToKeep.contains(s));
}
origin: gchq/Gaffer

/**
 * Remove properties from the supplied element, according to the {@link ViewElementDefinition}.
 *
 * @param elDef      the element definition to apply
 * @param properties the properties to modify
 */
public static void removeProperties(final ViewElementDefinition elDef, final Properties properties) {
  if (null != elDef && !elDef.isAllProperties()) {
    if (null == elDef.getProperties()) {
      elDef.getExcludeProperties().forEach(properties::remove);
    } else {
      properties.keepOnly(elDef.getProperties());
    }
  }
}
origin: gchq/Gaffer

@Test
public void shouldKeepOnlyGivenProperties() {
  // Given
  final String property1 = "property 1";
  final String property2 = "property 2";
  final String property3 = "property 3";
  final String property4 = "property 4";
  final String propertyValue1 = "property value 1";
  final String propertyValue2 = "property value 2";
  final String propertyValue3 = "property value 3";
  final String propertyValue4 = "property value 4";
  final Collection<String> propertiesToKeep = Arrays.asList(property1, property3);
  final Properties properties = new Properties();
  properties.put(property1, propertyValue1);
  properties.put(property2, propertyValue2);
  properties.put(property3, propertyValue3);
  properties.put(property4, propertyValue4);
  // When
  properties.keepOnly(propertiesToKeep);
  // Then
  assertEquals(2, properties.size());
  assertEquals(propertyValue1, properties.get(property1));
  assertEquals(propertyValue3, properties.get(property3));
}
origin: uk.gov.gchq.gaffer/data

@Override
public void keepOnly(final Collection<String> propertiesToKeep) {
  properties.keepOnly(propertiesToKeep);
  loadedProperties.removeIf(s -> !propertiesToKeep.contains(s));
}
origin: uk.gov.gchq.gaffer/data

/**
 * Remove properties from the supplied element, according to the {@link ViewElementDefinition}.
 *
 * @param elDef      the element definition to apply
 * @param properties the properties to modify
 */
public static void removeProperties(final ViewElementDefinition elDef, final Properties properties) {
  if (null != elDef && !elDef.isAllProperties()) {
    if (null == elDef.getProperties()) {
      elDef.getExcludeProperties().forEach(properties::remove);
    } else {
      properties.keepOnly(elDef.getProperties());
    }
  }
}
uk.gov.gchq.gaffer.data.elementPropertieskeepOnly

Javadoc

Removes all properties with names that are not in the provided set.

Popular methods of Properties

  • get
  • <init>
  • put
  • remove
  • clone
  • entrySet
  • isEmpty
  • keySet
  • putAll
  • size
  • clear
  • containsKey
  • clear,
  • containsKey,
  • containsValue,
  • equals,
  • hashCode,
  • toString,
  • values

Popular in Java

  • Running tasks concurrently on multiple threads
  • getApplicationContext (Context)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • onRequestPermissionsResult (Fragment)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • HttpServlet (javax.servlet.http)
    Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site. A sub
  • JFrame (javax.swing)
  • JList (javax.swing)
  • XPath (javax.xml.xpath)
    XPath provides access to the XPath evaluation environment and expressions. Evaluation of XPath Expr
  • Top 17 Plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now