congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
DataContainer.getLong
Code IndexAdd Tabnine 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)

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

  • Parsing JSON documents to java classes using gson
  • compareTo (BigDecimal)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • getSystemService (Context)
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • NoSuchElementException (java.util)
    Thrown when trying to retrieve an element past the end of an Enumeration or Iterator.
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • ZipFile (java.util.zip)
    This class provides random read access to a zip file. You pay more to read the zip file's central di
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • Top 15 Vim Plugins
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