congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
DataContainer.getInt
Code IndexAdd Tabnine to your IDE (free)

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

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

origin: SpongePowered/SpongeAPI

@Test
public void testSetData() {
  DataContainer container = DataContainer.createNew();
  DataQuery testQuery = of('.', "foo.bar");
  container.set(testQuery, 1);
  Optional<Integer> optional = container.getInt(testQuery);
  assertTrue(optional.isPresent());
}
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: SpongePowered/SpongeAPI

@Test
public void testIncorrectType() {
  DataContainer container = DataContainer.createNew();
  DataQuery testQuery = of("foo", "bar");
  container.set(testQuery, "foo");
  Optional<Integer> optional = container.getInt(testQuery);
  assertTrue(!optional.isPresent());
}
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: EngineHub/CraftBook

@Override
public Optional<LastPowerData> from(DataContainer container) {
  if (container.contains(CraftBookKeys.LAST_POWER.getQuery())) {
    return Optional.of(new LastPowerData(container.getInt(CraftBookKeys.LAST_POWER.getQuery()).get()));
  }
  return Optional.empty();
}
origin: prism/Prism

int count = result.data.getInt(DataQueries.Count).orElse(0);
if (count > 0) {
  resultMessage.append(Text.of(TextColors.GREEN, "x", count, " "));
org.spongepowered.api.dataDataContainergetInt

Popular methods of DataContainer

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

Popular in Java

  • Updating database using SQL prepared statement
  • getSupportFragmentManager (FragmentActivity)
  • getSharedPreferences (Context)
  • onCreateOptionsMenu (Activity)
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • File (java.io)
    An "abstract" representation of a file system entity identified by a pathname. The pathname may be a
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • JComboBox (javax.swing)
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Top plugins for WebStorm
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now