congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
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

  • Creating JSON documents from java classes using gson
  • onCreateOptionsMenu (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • scheduleAtFixedRate (Timer)
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • Time (java.sql)
    Java representation of an SQL TIME value. Provides utilities to format and parse the time's represen
  • Date (java.util)
    A specific moment in time, with millisecond precision. Values typically come from System#currentTime
  • ResourceBundle (java.util)
    ResourceBundle is an abstract class which is the superclass of classes which provide Locale-specifi
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • Option (scala)
  • Top plugins for Android Studio
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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