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

How to use
getType
method
in
uk.gov.gchq.gaffer.types.TypeValue

Best Java code snippets using uk.gov.gchq.gaffer.types.TypeValue.getType (Showing top 10 results out of 315)

origin: gchq/Gaffer

  @Override
  public int compareTo(final TypeValue typeValue) {
    if (null == typeValue) {
      return 1;
    }
    int i = stringComparator.compare(type, typeValue.getType());
    if (i != 0) {
      return i;
    }
    return stringComparator.compare(value, typeValue.getValue());
  }
}
origin: gchq/Gaffer

@Override
public byte[] serialise(final TypeValue typeValue) throws SerialisationException {
  String type = typeValue.getType();
  String value = typeValue.getValue();
  if ((null == type || type.isEmpty()) && (null == value || value.isEmpty())) {
    throw new SerialisationException("TypeValue passed to serialiser is blank");
  }
  ByteArrayOutputStream out = new ByteArrayOutputStream();
  if (null != type) {
    try {
      out.write(ByteArrayEscapeUtils.escape(type.getBytes(CommonConstants.UTF_8)));
    } catch (final IOException e) {
      throw new SerialisationException("Failed to serialise the Type from TypeValue Object", e);
    }
  }
  out.write(ByteArrayEscapeUtils.DELIMITER);
  if (null != value) {
    try {
      out.write(ByteArrayEscapeUtils.escape(value.getBytes(CommonConstants.UTF_8)));
    } catch (final IOException e) {
      throw new SerialisationException("Failed to serialise the Value from TypeValue Object", e);
    }
  }
  return out.toByteArray();
}
origin: gchq/Gaffer

@Test
public void testCanSerialiseDeSerialiseCorrectly() throws SerialisationException {
  TypeValue typeValue = new TypeValue("testType", "testValue");
  byte[] bytes = serialiser.serialise(typeValue);
  String serialisedForm = new String(bytes);
  assertEquals("testType\0testValue", serialisedForm);
  TypeValue deSerialisedTypeValue = serialiser.deserialise(bytes);
  assertEquals(typeValue.getType(), deSerialisedTypeValue.getType());
  assertEquals(typeValue.getValue(), deSerialisedTypeValue.getValue());
  assertEquals(typeValue, deSerialisedTypeValue);
}
origin: gchq/Gaffer

@Test
public void testCanSerialiseDeSerialiseCorrectlyTypeOnly() throws SerialisationException {
  TypeValue typeValue = new TypeValue();
  typeValue.setType("testType");
  byte[] bytes = serialiser.serialise(typeValue);
  String serialisedForm = new String(bytes);
  assertEquals("testType\0", serialisedForm);
  TypeValue deSerialisedTypeValue = serialiser.deserialise(bytes);
  assertEquals(typeValue.getType(), deSerialisedTypeValue.getType());
  assertNull(typeValue.getValue(), deSerialisedTypeValue.getValue());
  assertEquals(typeValue, deSerialisedTypeValue);
}
origin: gchq/Gaffer

@Test
public void testCanSerialiseDeserialiseCorrectlyAndBeEscaped() throws SerialisationException {
  TypeValue typeValue = new TypeValue("testType", "testValue");
  byte[] bytes = ByteArrayEscapeUtils.escape(serialiser.serialise(typeValue));
  String serialisedForm = new String(bytes);
  assertEquals("testType\1\1testValue", serialisedForm);
  TypeValue deSerialisedTypeValue = serialiser.deserialise(ByteArrayEscapeUtils
      .unEscape(bytes));
  assertEquals(typeValue.getType(), deSerialisedTypeValue.getType());
  assertEquals(typeValue.getValue(), deSerialisedTypeValue.getValue());
  assertEquals(typeValue, deSerialisedTypeValue);
}
origin: gchq/Gaffer

@Test
public void testCanSerialiseDeSerialiseCorrectlyValueOnly() throws SerialisationException {
  TypeValue typeValue = new TypeValue();
  typeValue.setValue("testValue");
  byte[] bytes = serialiser.serialise(typeValue);
  String serialisedForm = new String(bytes);
  assertEquals("\0testValue", serialisedForm);
  TypeValue deSerialisedTypeValue = serialiser.deserialise(bytes);
  assertNull(deSerialisedTypeValue.getType());
  assertEquals(typeValue.getValue(), deSerialisedTypeValue.getValue());
  assertEquals(typeValue, deSerialisedTypeValue);
}
origin: uk.gov.gchq.gaffer/parquet-store

@Override
public Object[] serialise(final TypeValue object) throws SerialisationException {
  if (null != object) {
    return new Object[]{object.getType(), object.getValue()};
  }
  return new Object[]{null, null};
}
origin: uk.gov.gchq.gaffer/type

  @Override
  public int compareTo(final TypeValue typeValue) {
    if (null == typeValue) {
      return 1;
    }
    int i = stringComparator.compare(type, typeValue.getType());
    if (i != 0) {
      return i;
    }
    return stringComparator.compare(value, typeValue.getValue());
  }
}
origin: uk.gov.gchq.gaffer/type

@Override
public byte[] serialise(final TypeValue typeValue) throws SerialisationException {
  String type = typeValue.getType();
  String value = typeValue.getValue();
  if ((null == type || type.isEmpty()) && (null == value || value.isEmpty())) {
    throw new SerialisationException("TypeValue passed to serialiser is blank");
  }
  ByteArrayOutputStream out = new ByteArrayOutputStream();
  if (null != type) {
    try {
      out.write(ByteArrayEscapeUtils.escape(type.getBytes(CommonConstants.UTF_8)));
    } catch (final IOException e) {
      throw new SerialisationException("Failed to serialise the Type from TypeValue Object", e);
    }
  }
  out.write(ByteArrayEscapeUtils.DELIMITER);
  if (null != value) {
    try {
      out.write(ByteArrayEscapeUtils.escape(value.getBytes(CommonConstants.UTF_8)));
    } catch (final IOException e) {
      throw new SerialisationException("Failed to serialise the Value from TypeValue Object", e);
    }
  }
  return out.toByteArray();
}
origin: uk.gov.gchq.gaffer/spark-library

@Override
public void write(final Kryo kryo, final Output output, final TypeValue typeValue) {
  output.writeString(typeValue.getType());
  output.writeString(typeValue.getValue());
}
uk.gov.gchq.gaffer.typesTypeValuegetType

Popular methods of TypeValue

  • <init>
  • getValue
  • setType
  • setValue
  • compareTo
  • equals
  • hashCode

Popular in Java

  • Making http post requests using okhttp
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • getSupportFragmentManager (FragmentActivity)
  • HashSet (java.util)
    HashSet is an implementation of a Set. All optional operations (adding and removing) are supported.
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
  • Reference (javax.naming)
  • JFileChooser (javax.swing)
  • Loader (org.hibernate.loader)
    Abstract superclass of object loading (and querying) strategies. This class implements useful common
  • 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