Codota Logo
EventBusService.getTypesafeValueForField
Code IndexAdd Codota to your IDE (free)

How to use
getTypesafeValueForField
method
in
org.eclipse.hono.service.EventBusService

Best Java code snippets using org.eclipse.hono.service.EventBusService.getTypesafeValueForField (Showing top 3 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: eclipse/hono

/**
 * Verify that the method actually returns null when the type does not match.
 */
@Test
public void testInvalidType() {
  final JsonObject device = new JsonObject().put("device-id", "someValue");
  final String stringValue = EventBusService.getTypesafeValueForField(String.class, device, "device-id");
  Assert.assertEquals("someValue", stringValue);
  final Integer intValue = EventBusService.getTypesafeValueForField(Integer.class, device, "device-id");
  Assert.assertNull(intValue);
}
origin: eclipse/hono

/**
 * Verify that a valid type works.
 */
@Test
public void testValidType() {
  final JsonObject payload = new JsonObject()
      .put("booleanValue", true)
      .put("stringValue", "foo")
      .put("intValue", 42);
  final String stringValue = EventBusService.getTypesafeValueForField(String.class, payload, "stringValue");
  Assert.assertEquals("foo", stringValue);
  final Integer intValue = EventBusService.getTypesafeValueForField(Integer.class, payload, "intValue");
  Assert.assertEquals(Integer.valueOf(42), intValue);
  final Boolean booleanValue = EventBusService.getTypesafeValueForField(Boolean.class, payload, "booleanValue");
  Assert.assertEquals(Boolean.TRUE, booleanValue);
}
origin: eclipse/hono

/**
 * Verify that the method returns null, when the value is null.
 */
@Test
public void testGetNull() {
  final JsonObject device = new JsonObject().put("device-id", (String) null);
  final String value = EventBusService.getTypesafeValueForField(String.class, device, "device-id");
  Assert.assertNull(value);
}
org.eclipse.hono.serviceEventBusServicegetTypesafeValueForField

Javadoc

Gets a property value of a given type from a JSON object.

Popular methods of EventBusService

  • doStart
    Subclasses should override this method to perform any work required on start-up of this service. Thi
  • doStop
    Subclasses should override this method to perform any work required before shutting down this servic
  • getEventBusAddress
    Gets the event bus address that this service listens on for incoming requests.
  • getRequestPayload
    Gets the payload from a request message. The returned JSON object contains the given payload (if not
  • processRequest
    Processes a service invocation request. The response message returned in the future will be sent ove
  • registerConsumer

Popular in Java

  • Making http post requests using okhttp
  • getSharedPreferences (Context)
  • getSystemService (Context)
  • putExtra (Intent)
  • Kernel (java.awt.image)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Timer (java.util)
    A facility for threads to schedule tasks for future execution in a background thread. Tasks may be s
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
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