congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
org.spongepowered.api.data
Code IndexAdd Tabnine to your IDE (free)

How to use org.spongepowered.api.data

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

origin: SpongePowered/SpongeAPI

  @Override
  protected boolean apply(Property<?, ?> operand1, Property<?, ?> operand2) {
    return operand2.getOperator() != Operator.DELEGATE && operand2.getOperator().compare(operand1, operand2);
  }
},
origin: SpongePowered/SpongeAPI

/**
 * Creates a new {@link DataTransactionResult} that ends in failure. The
 * provided {@link ImmutableValue}s are considered "rejected" and were not
 * successfully added.
 *
 * @param values The values that were rejected
 * @return The new data transaction result
 */
public static DataTransactionResult failResult(final Iterable<ImmutableValue<?>> values) {
  return builder().reject(values).result(Type.FAILURE).build();
}
origin: SpongePowered/SpongeAPI

/**
 * Creates a new {@link DataContainer} with the provided
 * {@link org.spongepowered.api.data.DataView.SafetyMode}.
 *
 * @param safety The safety mode to use
 * @see org.spongepowered.api.data.DataView.SafetyMode
 * @return A new data container with the provided safety mode
 */
static DataContainer createNew(SafetyMode safety) {
  return new MemoryDataContainer(safety);
}
origin: SpongePowered/SpongeAPI

@Override
public DataContainer toContainer() {
  DataContainer container = DataContainer.createNew();
  container.set(DataQuery.of("myInt"), this.testInt);
  container.set(DataQuery.of("myDouble"), this.testDouble);
  container.set(DataQuery.of("myString"), this.testString);
  container.set(DataQuery.of("myStringList"), Arrays.asList(this.testList));
  return container;
}
origin: SpongePowered/SpongeAPI

/**
 * Creates a {@link DataTransactionResult} with the provided
 * {@link ImmutableValue}s being successfully removed. The result type is
 * still {@link Type#SUCCESS}. If a {@link Value} is necessary, use
 * {@link Value#asImmutable()} to use this method. A {@link DataTransactionResult}
 * is always immutable once created, and any {@link BaseValue}s should be provided
 * as {@link ImmutableValue}s or transformed into {@link ImmutableValue}s.
 *
 * @param removed The successfully removed values
 * @return The new data transaction result
 */
public static DataTransactionResult successRemove(Collection<ImmutableValue<?>> removed) {
  return builder().replace(removed).result(Type.SUCCESS).build();
}
origin: SpongePowered/SpongeAPI

private void copyDataView(DataQuery path, DataView value) {
  Collection<DataQuery> valueKeys = value.getKeys(true);
  for (DataQuery oldKey : valueKeys) {
    set(path.then(oldKey), value.get(oldKey).get());
  }
}
origin: SpongePowered/SpongeAPI

private Type absorbedType(Type builderType, Type resultType) {
  DataTransactionResult result = DataTransactionResult.builder().result(resultType).build();
  DataTransactionResult absorbed = DataTransactionResult.builder().result(builderType).absorbResult(result).build();
  return absorbed.getType();
}
origin: SpongePowered/SpongeAPI

/**
 * Gets whether this {@link DataTransactionResult} was successful or not.
 *
 * @return True if this result was successful
 */
public boolean isSuccessful() {
  return getType() == Type.SUCCESS;
}
origin: SpongePowered/SpongeAPI

@Override
public String toString() {
  return asString('.');
}
origin: SpongePowered/SpongeAPI

/**
 * Constructs a query using the given parts.
 *
 * @param parts The parts
 * @return The newly constructed {@link DataQuery}
 */
public static DataQuery of(String... parts) {
  if (parts.length == 0) {
    return DataQuery.EMPTY;
  }
  return new DataQuery(parts);
}
origin: SpongePowered/SpongeAPI

/**
 * Gets a new {@link Builder} to build a new
 * {@link DataTransactionResult}.
 *
 * @return The new builder, for chaining
 */
public static Builder builder() {
  return new Builder();
}
origin: SpongePowered/SpongeAPI

@Override
public DataContainer remove(DataQuery path) {
  return (DataContainer) super.remove(path);
}
origin: SpongePowered/SpongeAPI

@Override
public DataContainer set(DataQuery path, Object value) {
  return (DataContainer) super.set(path, value);
}
origin: SpongePowered/SpongeAPI

@Test
public void testTest() {
  DataContainer containertest = DataContainer.createNew();
  DataContainer containertest2 = DataContainer.createNew();
  containertest.set(DataQuery.of("test1", "test2", "test3"), containertest2);
}
origin: SpongePowered/SpongeAPI

/**
 * Creates a new {@link DataTransactionResult} with the provided
 * {@link ImmutableValue} being the successful addition. The result type is
 * still {@link Type#SUCCESS}. If a {@link Value} is
 * necessary, use {@link Value#asImmutable()} to use this method. A
 * {@link DataTransactionResult} is always immutable once created, and any
 * {@link BaseValue}s should be provided as {@link ImmutableValue}s or
 * transformed into {@link ImmutableValue}s.
 *
 * @param value The successfully added immutable value
 * @return The new data transaction result
 */
public static DataTransactionResult successResult(final ImmutableValue<?> value) {
  return builder().success(value).result(Type.SUCCESS).build();
}
origin: SpongePowered/SpongeAPI

/**
 * Creates a new {@link DataTransactionResult} that ends in failure. The
 * provided {@link ImmutableValue} is considered "incompatible" and was not
 * successfully added.
 *
 * @param value The value that was incompatible or errored
 * @return The new data transaction result
 */
public static DataTransactionResult errorResult(final ImmutableValue<?> value) {
  return builder().result(Type.ERROR).reject(value).build();
}
origin: SpongePowered/SpongeAPI

/**
 * Creates a new {@link DataContainer} with a default
 * {@link org.spongepowered.api.data.DataView.SafetyMode} of
 * {@link org.spongepowered.api.data.DataView.SafetyMode#ALL_DATA_CLONED}.
 *
 * @return A new data container
 */
static DataContainer createNew() {
  // TODO - Move to implementation - unit tests are difficult...
  return new MemoryDataContainer();
}
origin: SpongePowered/SpongeAPI

/**
 * Creates a {@link DataTransactionResult} with the provided
 * {@link ImmutableValue} being successfully removed. The result type is
 * still {@link Type#SUCCESS}. If a {@link Value} is necessary, use
 * {@link Value#asImmutable()} to use this method. A
 * {@link DataTransactionResult} is always immutable once created, and a
 * {@link BaseValue} should be provided as an {@link ImmutableValue} or
 * transformed into an {@link ImmutableValue}.
 *
 * @param removed The successfully removed value
 * @return The new data transaction result
 */
public static DataTransactionResult successRemove(ImmutableValue<?> removed) {
  return builder().replace(removed).result(Type.SUCCESS).build();
}
origin: SpongePowered/SpongeAPI

/**
 * Creates a new {@link DataTransactionResult} that ends in failure. The
 * provided {@link ImmutableValue} is considered "rejected" and was not
 * successfully added.
 *
 * @param value The value that was rejected
 * @return The new data transaction result
 */
public static DataTransactionResult failResult(final ImmutableValue<?> value) {
  return builder().reject(value).result(Type.FAILURE).build();
}
origin: SpongePowered/SpongeAPI

/**
 * Creates a new {@link DataTransactionResult} with the provided
 * {@link ImmutableValue}s being the successful additions and
 * the provided {@link ImmutableValue}s that were replaced. The result type
 * is still {@link Type#SUCCESS}. If a {@link Value}
 * is necessary, use {@link Value#asImmutable()} to use this method. A
 * {@link DataTransactionResult} is always immutable once created, and any
 * {@link BaseValue}s should be provided as {@link ImmutableValue}s or
 * transformed into {@link ImmutableValue}s.
 *
 * @param successful The successfully added immutable values
 * @param replaced The successfully replaced immutable values
 * @return The new data transaction result
 */
public static DataTransactionResult successReplaceResult(Collection<ImmutableValue<?>> successful, Collection<ImmutableValue<?>> replaced) {
  return builder().success(successful).replace(replaced).result(Type.SUCCESS).build();
}
org.spongepowered.api.data

Most used classes

  • Transaction
  • Value
    Represents a type of BaseValue that is mutable. Simply put, the underlying value can always be chang
  • DataContainer
    Represents a data structure that contains data. A DataContainer is an object that can be considered
  • DataQuery
    Represents a query that can be done on views. Queries do not depend on their separator, it is just a
  • DataView
    Represents an object of data represented by a map.DataViews always exist within a DataContainer and
  • SignData,
  • MutableBoundedValue,
  • DataManager,
  • DataTransactionResult,
  • Key,
  • DisplayNameData,
  • GameModeData,
  • MergeFunction,
  • DataTranslator,
  • InvalidDataException,
  • MatterProperty,
  • ValueFactory,
  • DataRegistration$Builder,
  • DataTransactionResult$Builder
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