Codota Logo
Properties.keepOnly
Code IndexAdd Codota 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)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
BufferedReader b =
  • Codota IconInputStream in;new BufferedReader(new InputStreamReader(in))
  • Codota IconReader in;new BufferedReader(in)
  • Codota IconFile file;new BufferedReader(new FileReader(file))
  • Smart code suggestions by Codota
}
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

  • Making http post requests using okhttp
  • onCreateOptionsMenu (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • onRequestPermissionsResult (Fragment)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • Point (java.awt)
    A point representing a location in (x, y) coordinate space, specified in integer precision.
  • Kernel (java.awt.image)
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • IsNull (org.hamcrest.core)
    Is the value null?
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now