Codota Logo
DataContainer.getLong
Code IndexAdd Codota to your IDE (free)

How to use
getLong
method
in
org.spongepowered.api.data.DataContainer

Best Java code snippets using org.spongepowered.api.data.DataContainer.getLong (Showing top 3 results out of 315)

  • Common ways to obtain DataContainer
private void myMethod () {
DataContainer d =
  • Codota IconDataContainer.createNew()
  • Smart code suggestions by Codota
}
origin: SpongePowered/SpongeAPI

@Test
public void testNumbers() {
  DataContainer container = DataContainer.createNew();
  DataQuery testQuery = of("foo", "bar");
  container.set(testQuery, 1.0D);
  Optional<Integer> integerOptional = container.getInt(testQuery);
  assertTrue(integerOptional.isPresent());
  assertTrue(integerOptional.get() == 1);
  Optional<Long> longOptional = container.getLong(testQuery);
  assertTrue(longOptional.isPresent());
  assertTrue(longOptional.get() == 1L);
  Optional<Double> doubleOptional = container.getDouble(testQuery);
  assertTrue(doubleOptional.isPresent());
  assertTrue(doubleOptional.get() == 1.0D);
}
origin: SpongePowered/SpongeAPI

@Test
public void testAbsents() {
  DataContainer container = DataContainer.createNew();
  DataQuery testQuery = of("foo", "bar", "baz");
  assertTrue(!container.get(testQuery).isPresent());
  assertTrue(!container.getBoolean(testQuery).isPresent());
  assertTrue(!container.getBooleanList(testQuery).isPresent());
  assertTrue(!container.getByteList(testQuery).isPresent());
  assertTrue(!container.getCharacterList(testQuery).isPresent());
  assertTrue(!container.getDouble(testQuery).isPresent());
  assertTrue(!container.getDoubleList(testQuery).isPresent());
  assertTrue(!container.getFloatList(testQuery).isPresent());
  assertTrue(!container.getInt(testQuery).isPresent());
  assertTrue(!container.getIntegerList(testQuery).isPresent());
  assertTrue(!container.getList(testQuery).isPresent());
  assertTrue(!container.getLong(testQuery).isPresent());
  assertTrue(!container.getLongList(testQuery).isPresent());
  assertTrue(!container.getMapList(testQuery).isPresent());
  assertTrue(!container.getShortList(testQuery).isPresent());
  assertTrue(!container.getString(testQuery).isPresent());
  assertTrue(!container.getStringList(testQuery).isPresent());
  assertTrue(!container.getView(testQuery).isPresent());
}
origin: EngineHub/CraftBook

@Override
public Optional<BlockBagData> from(DataContainer container) {
  if (container.contains(CraftBookKeys.BLOCK_BAG.getQuery())) {
    return Optional.of(new BlockBagData(container.getLong(CraftBookKeys.BLOCK_BAG.getQuery()).get()));
  }
  return Optional.empty();
}
org.spongepowered.api.dataDataContainergetLong

Popular methods of DataContainer

  • set
  • createNew
    Creates a new DataContainer with the provided org.spongepowered.api.data.DataView.SafetyMode.
  • get
  • contains
  • getInt
  • getSerializable
  • getString
  • getView
  • createView
  • copy
  • getBoolean
  • getBooleanList
  • getBoolean,
  • getBooleanList,
  • getByteList,
  • getCharacterList,
  • getDouble,
  • getDoubleList,
  • getFloatList,
  • getIntegerList,
  • getList

Popular in Java

  • Finding current android device location
  • scheduleAtFixedRate (ScheduledExecutorService)
  • getApplicationContext (Context)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • Socket (java.net)
    Provides a client-side TCP socket.
  • ByteBuffer (java.nio)
    A buffer for bytes. A byte buffer can be created in either one of the following ways: * #allocate(i
  • DecimalFormat (java.text)
    DecimalFormat is a concrete subclass ofNumberFormat that formats decimal numbers. It has a variety o
  • ConcurrentHashMap (java.util.concurrent)
    A hash table supporting full concurrency of retrievals and adjustable expected concurrency for updat
  • Semaphore (java.util.concurrent)
    A counting semaphore. Conceptually, a semaphore maintains a set of permits. Each #acquire blocks if
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