congrats Icon
New! Tabnine Pro 14-day free trial
Start a free trial
Tabnine Logo
Properties
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: gchq/Gaffer

@Test
public void shouldRemovePropertyIfAddedWithNullValue() {
  // Given
  final Properties properties = new Properties();
  properties.put("property1", "propertyValue1");
  properties.put("property2", "propertyValue2");
  // When
  properties.put("property1", null);
  // Then
  assertEquals(1, properties.size());
  assertEquals(null, properties.get("property1"));
}
origin: gchq/Gaffer

public void remove(final Collection<String> propertiesToRemove) {
  if (null != propertiesToRemove) {
    for (final String property : propertiesToRemove) {
      remove(property);
    }
  }
}
origin: gchq/Gaffer

@SuppressWarnings("CloneDoesntCallSuperClone")
@SuppressFBWarnings(value = "CN_IDIOM_NO_SUPER_CALL", justification = "Doesn't use any properties in super class")
@Override
public LazyProperties clone() {
  return new LazyProperties(properties.clone(), valueLoader);
}
origin: gchq/Gaffer

@Test
public void shouldNotAddPropertyIfPropertyNameIsNull() {
  // When
  final Properties properties = new Properties();
  properties.put(null, "propertyValue1");
  // Then
  assertEquals(0, properties.size());
}
origin: gchq/Gaffer

@Test
public void shouldAddPropertyToMapWhenAddingProperty() {
  // Given
  final ElementValueLoader elementLoader = mock(ElementValueLoader.class);
  final Properties properties = new Properties();
  final String propertyName = "property name";
  final String propertyValue = "property value";
  final LazyProperties lazyProperties = new LazyProperties(properties, elementLoader);
  given(elementLoader.getProperty(propertyName, lazyProperties)).willReturn(propertyValue);
  // When
  lazyProperties.put(propertyName, propertyValue);
  // Then
  verify(elementLoader, never()).getProperty(propertyName, lazyProperties);
  assertEquals(propertyValue, properties.get(propertyName));
}
origin: gchq/Gaffer

@Test
public void shouldAggregatePropertiesWithMultipleOfFunctions() {
  // Given
  final BinaryOperator<Integer> max = Math::max;
  final BinaryOperator<Integer> min = Math::min;
  final ElementAggregator aggregator = new ElementAggregator.Builder()
      .select("max")
      .execute(max)
      .select("min")
      .execute(min)
      .build();
  final Properties properties1 = new Properties();
  properties1.put("max", 10);
  properties1.put("min", 10);
  final Properties properties2 = new Properties();
  properties2.put("max", 100);
  properties2.put("min", 100);
  final Properties properties3 = new Properties();
  properties3.put("max", 1000);
  properties3.put("min", 1000);
  // When
  Properties state = aggregator.apply(properties1, properties2);
  state = aggregator.apply(state, properties3);
  // Then
  assertEquals(1000, state.get("max"));
  assertEquals(10, state.get("min"));
}
origin: gchq/Gaffer

@Override
public Object get(final String propertyName) {
  return properties.get(propertyName);
}
origin: gchq/Gaffer

@Test
public void shouldSerialiseAndDeserialiseProperties() throws SerialisationException {
  // Given
  final Element element = newElement("group");
  final Properties properties = new Properties();
  properties.put("property1", 1L);
  properties.put("property2", 2);
  properties.put("property3", (double) 3);
  properties.put("property4", "4");
  properties.put("property5", new Date(5L));
  element.setProperties(properties);
  // When
  final byte[] serialisedElement = JSONSerialiser.serialise(element);
  final Element deserialisedElement = JSONSerialiser.deserialise(serialisedElement, element.getClass());
  // Then
  assertTrue(StringUtil.toString(serialisedElement).contains("{\"java.util.Date\":5}"));
  assertEquals(element, deserialisedElement);
}
origin: gchq/Gaffer

@Test
public void shouldConstructPropertiesWithOtherProperties() {
  // Given
  final Map<String, Object> otherProperties = new HashMap<>();
  otherProperties.put("propertyName", "property value");
  // When
  final Properties properties = new Properties(otherProperties);
  // Then
  assertEquals(1, properties.size());
  assertEquals("property value", properties.get("propertyName"));
}
origin: gchq/Gaffer

public Builder property(final String name, final Object value) {
  properties.put(name, value);
  return this;
}
origin: gchq/Gaffer

@Test
public void shouldNotRemovePropertiesWhenNoRelevantExcludeProperties() {
  //Given
  final View view = new View.Builder()
      .edge(TestGroups.EDGE, new ViewElementDefinition.Builder()
          .excludeProperties(TestPropertyNames.COUNT)
          .build())
      .entity(TestGroups.ENTITY, new ViewElementDefinition.Builder()
          .properties(TestPropertyNames.PROP_2)
          .build())
      .build();
  final Edge edge = new Edge.Builder()
      .group(TestGroups.EDGE)
      .property(TestPropertyNames.PROP_1, "1")
      .property(TestPropertyNames.PROP_2, "2")
      .property(TestPropertyNames.PROP_3, "3")
      .build();
  //When
  ViewUtil.removeProperties(view, edge);
  //Then
  assertEquals(3, edge.getProperties().size());
  assertEquals("1", edge.getProperties().get(TestPropertyNames.PROP_1));
  assertEquals("2", edge.getProperties().get(TestPropertyNames.PROP_2));
  assertEquals("3", edge.getProperties().get(TestPropertyNames.PROP_3));
}
origin: gchq/Gaffer

Element(final String group, final Properties properties) {
  this.group = group;
  if (null == properties) {
    this.properties = new Properties();
  } else {
    this.properties = properties;
  }
}
origin: gchq/Gaffer

  @Test
  public void shouldReturnHumanReadableToString() {
    // Given
    final String property1 = "property 1";
    final String property2 = "property 2";
    final String propertyValue1 = "property value 1";
    final String propertyValue2 = "property value 2";
    final Properties properties = new Properties();
    properties.put(property1, propertyValue1);
    properties.put(property2, propertyValue2);

    // When
    final String toString = properties.toString();

    // Then
    assertTrue(toString.contains("property 2="
        + "<java.lang.String>property value 2"));
    assertTrue(toString.contains("property 1="
        + "<java.lang.String>property value 1"));
  }
}
origin: uk.gov.gchq.gaffer/accumulo-store

final Properties properties = new Properties();
try {
  properties.putAll(elementConverter.getPropertiesFromColumnQualifier(group, topColumnQualifier));
  properties.putAll(elementConverter.getPropertiesFromColumnVisibility(group, topColumnVisibility));
  properties.putAll(elementConverter.getPropertiesFromValue(group, topValue));
  properties.putAll(elementConverter.getPropertiesFromTimestamp(group, topTimestamp));
  if (null == groupBy) {
    if (null != schemaGroupBy) {
      properties.remove(schemaGroupBy);
    properties.remove(groupBy);
origin: gchq/Gaffer

@Test
public void shouldConstructEmptyProperties() {
  // Given
  // When
  final Properties properties = new Properties();
  // Then
  assertTrue(properties.isEmpty());
}
origin: gchq/Gaffer

@Test
public void shouldCopyProperties() {
  // Given
  final Element element1 = newElement("group");
  final Properties newProperties = new Properties("property1", "propertyValue1");
  // When
  element1.copyProperties(newProperties);
  // Then
  assertEquals(1, element1.getProperties().size());
  assertEquals("propertyValue1", element1.getProperty("property1"));
}
origin: uk.gov.gchq.gaffer/accumulo-store

  @Override
  public Object getProperty(final String name, final Properties lazyProperties) {
    if (null == eDef) {
      eDef = schema.getElement(group);
      if (null == eDef) {
        throw new IllegalArgumentException("Element definition for " + group + " could not be found in the schema");
      }
    }

    final Properties props;
    if (eDef.getGroupBy().contains(name)) {
      props = elementConverter.getPropertiesFromColumnQualifier(group, key.getColumnQualifierData().getBackingArray());
    } else if (name.equals(schema.getVisibilityProperty())) {
      props = elementConverter.getPropertiesFromColumnVisibility(group, key.getColumnVisibilityData().getBackingArray());
    } else if (name.equals(timestampProperty)) {
      props = elementConverter.getPropertiesFromTimestamp(group, key.getTimestamp());
    } else {
      props = elementConverter.getPropertiesFromValue(group, value);
    }
    lazyProperties.putAll(props);
    return props.get(name);
  }
}
origin: gchq/Gaffer

@Override
public Set<Map.Entry<String, Object>> entrySet() {
  return properties.entrySet();
}
origin: gchq/Gaffer

@Override
public Set<String> keySet() {
  return properties.keySet();
}
origin: gchq/Gaffer

@Override
public void putAll(final Map<? extends String, ?> newProperties) {
  properties.putAll(newProperties);
  loadedProperties.addAll(newProperties.keySet());
}
uk.gov.gchq.gaffer.data.elementProperties

Javadoc

Properties simply extends java.util.HashMap with property names (String) as keys and property value (Object) as values.

Most used methods

  • get
  • <init>
  • put
  • remove
  • clone
  • entrySet
  • isEmpty
  • keepOnly
    Removes all properties with names that are not in the provided set.
  • keySet
  • putAll
  • size
  • clear
  • size,
  • clear,
  • containsKey,
  • containsValue,
  • equals,
  • hashCode,
  • toString,
  • values

Popular in Java

  • Reading from database using SQL prepared statement
  • getSystemService (Context)
  • getApplicationContext (Context)
  • setContentView (Activity)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • OutputStream (java.io)
    A writable sink for bytes.Most clients will use output streams that write data to the file system (
  • Selector (java.nio.channels)
    A controller for the selection of SelectableChannel objects. Selectable channels can be registered w
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • Sublime Text for Python
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