当前位置: 首页>>代码示例>>Java>>正文


Java DataTransactionResult.failNoData方法代码示例

本文整理汇总了Java中org.spongepowered.api.data.DataTransactionResult.failNoData方法的典型用法代码示例。如果您正苦于以下问题:Java DataTransactionResult.failNoData方法的具体用法?Java DataTransactionResult.failNoData怎么用?Java DataTransactionResult.failNoData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.spongepowered.api.data.DataTransactionResult的用法示例。


在下文中一共展示了DataTransactionResult.failNoData方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: remove

import org.spongepowered.api.data.DataTransactionResult; //导入方法依赖的package包/类
@Override
default DataTransactionResult remove(Class<? extends DataManipulator<?,?>> containerClass) {
    checkNotNull(containerClass, "containerClass");
    // You cannot remove default data manipulators?
    final Optional optRegistration = DataManipulatorRegistry.get().getBy(containerClass);
    if (optRegistration.isPresent()) {
        return DataTransactionResult.failNoData();
    }

    if (this instanceof AdditionalContainerHolder) {
        final AdditionalContainerCollection<DataManipulator<?,?>> containers =
                ((AdditionalContainerHolder<DataManipulator<?,?>>) this).getAdditionalContainers();
        final Optional<DataManipulator<?,?>> old = containers.remove(containerClass);
        if (old.isPresent()) {
            return DataTransactionResult.successRemove(old.get().getValues());
        }
    }

    return DataTransactionResult.failNoData();
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:21,代码来源:IDataHolder.java

示例2: removeFrom

import org.spongepowered.api.data.DataTransactionResult; //导入方法依赖的package包/类
@Override
public DataTransactionResult removeFrom(IValueContainer<?> valueContainer) {
    DataTransactionResult result = null;
    for (Processor<V, E> processor : this.processors) {
        result = processor.removeFrom(valueContainer);
        if (result.isSuccessful()) {
            return result;
        }
    }
    return result == null ? DataTransactionResult.failNoData() : result;
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:12,代码来源:SimpleProcessorKeyRegistration.java

示例3: offerTo

import org.spongepowered.api.data.DataTransactionResult; //导入方法依赖的package包/类
@Override
public DataTransactionResult offerTo(IValueContainer<?> valueContainer, E element) {
    DataTransactionResult result = null;
    for (Processor<V, E> processor : this.processors) {
        result = processor.offerTo(valueContainer, element);
        if (result.isSuccessful()) {
            return result;
        }
    }
    return result == null ? DataTransactionResult.failNoData() : result;
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:12,代码来源:SimpleProcessorKeyRegistration.java

示例4: offerTo

import org.spongepowered.api.data.DataTransactionResult; //导入方法依赖的package包/类
@Override
public DataTransactionResult offerTo(IValueContainer<?> valueContainer, E element) {
    if (!isApplicableTo(valueContainer)) {
        return DataTransactionResult.failNoData();
    }
    return isApplicableTo(valueContainer) ? this.offerHandler.offer(valueContainer, getKey(), element) : DataTransactionResult.failNoData();
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:8,代码来源:SimpleValueProcessor.java

示例5: removeNoEvents

import org.spongepowered.api.data.DataTransactionResult; //导入方法依赖的package包/类
default DataTransactionResult removeNoEvents(Key<?> key) {
    checkNotNull(key, "key");

    // Check the local key registration
    final KeyRegistration<?, ?> localKeyRegistration = (KeyRegistration<?, ?>) getValueCollection().get((Key) key).orElse(null);
    if (localKeyRegistration != null) {
        return ((Processor<BaseValue<?>, ?>) localKeyRegistration).removeFrom(this);
    }

    // Check for a global registration
    final Optional<ValueProcessorKeyRegistration> globalRegistration = LanternValueFactory.get().getKeyRegistration((Key) key);
    if (globalRegistration.isPresent()) {
        return ((Processor<BaseValue<?>, ?>) globalRegistration.get()).removeFrom(this);
    }

    // Check if custom data is supported by this container
    if (this instanceof AdditionalContainerHolder) {
        // Check for the custom value containers
        final AdditionalContainerCollection<H> containers = ((AdditionalContainerHolder<H>) this).getAdditionalContainers();
        for (H valueContainer : containers.getAll()) {
            if (valueContainer.supports(key)) {
                if (valueContainer instanceof ICompositeValueStore) {
                    return ((ICompositeValueStore) valueContainer).removeNoEvents(key);
                } else if (valueContainer instanceof CompositeValueStore) {
                    return ((CompositeValueStore) valueContainer).remove(key);
                }
                return DataTransactionResult.failNoData();
            }
        }
    }

    return DataTransactionResult.failNoData();
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:34,代码来源:ICompositeValueStore.java

示例6: removeFrom

import org.spongepowered.api.data.DataTransactionResult; //导入方法依赖的package包/类
@Override
public DataTransactionResult removeFrom(ValueContainer<?> container) {
    return DataTransactionResult.failNoData();
}
 
开发者ID:gabizou,项目名称:ThaumicSponge,代码行数:5,代码来源:PlayerWarpDataProcessor.java

示例7: remove

import org.spongepowered.api.data.DataTransactionResult; //导入方法依赖的package包/类
@Override
public DataTransactionResult remove(DataHolder dataHolder) {
    return DataTransactionResult.failNoData();
}
 
开发者ID:gabizou,项目名称:ThaumicSponge,代码行数:5,代码来源:AuraNodeDataProcessor.java

示例8: removeFrom

import org.spongepowered.api.data.DataTransactionResult; //导入方法依赖的package包/类
@Override
public DataTransactionResult removeFrom(IValueContainer<?> valueContainer) {
    return isApplicableTo(valueContainer) ? this.removeHandler.remove(valueContainer, this) : DataTransactionResult.failNoData();
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:5,代码来源:SimpleElementProcessor.java

示例9: offerTo

import org.spongepowered.api.data.DataTransactionResult; //导入方法依赖的package包/类
@Override
public DataTransactionResult offerTo(IValueContainer<?> valueContainer, E element) {
    return isApplicableTo(valueContainer) ? this.offerHandler.offer(valueContainer, this, element) : DataTransactionResult.failNoData();
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:5,代码来源:SimpleElementProcessor.java

示例10: removeFrom

import org.spongepowered.api.data.DataTransactionResult; //导入方法依赖的package包/类
@Override
public DataTransactionResult removeFrom(IValueContainer<?> valueContainer) {
    return isApplicableTo(valueContainer) ? this.removeHandler.remove(valueContainer, getKey()) : DataTransactionResult.failNoData();
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:5,代码来源:SimpleValueProcessor.java

示例11: offerNoEvents

import org.spongepowered.api.data.DataTransactionResult; //导入方法依赖的package包/类
default <E> DataTransactionResult offerNoEvents(Key<? extends BaseValue<E>> key, E element) {
    // Check the local key registration
    final KeyRegistration<?, ?> localKeyRegistration = (KeyRegistration<?, ?>) getValueCollection().get((Key) key).orElse(null);
    if (localKeyRegistration != null) {
        return ((Processor<BaseValue<E>, E>) localKeyRegistration).offerTo(this, element);
    }

    // Check for a global registration
    final Optional<ValueProcessorKeyRegistration> globalRegistration = LanternValueFactory.get().getKeyRegistration((Key) key);
    if (globalRegistration.isPresent()) {
        return ((Processor<BaseValue<E>, E>) globalRegistration.get()).offerTo(this, element);
    }

    // Check if custom data is supported by this container
    if (this instanceof AdditionalContainerHolder) {
        // Check for the custom value containers
        final AdditionalContainerCollection<H> containers = ((AdditionalContainerHolder<H>) this).getAdditionalContainers();
        for (H valueContainer : containers.getAll()) {
            if (valueContainer.supports(key)) {
                if (valueContainer instanceof ICompositeValueStore) {
                    return ((ICompositeValueStore) valueContainer).offerNoEvents(key, element);
                } else if (valueContainer instanceof CompositeValueStore) {
                    return ((CompositeValueStore) valueContainer).offer(key, element);
                } else if (valueContainer instanceof DataManipulator) {
                    final ImmutableValue oldImmutableValue = (ImmutableValue) valueContainer.getValue((Key) key)
                            .map(value -> ValueHelper.toImmutable((BaseValue) value))
                            .orElse(null);
                    ((DataManipulator) valueContainer).set(key, element);
                    final ImmutableValue immutableValue = (ImmutableValue) valueContainer.getValue((Key) key)
                            .map(value -> ValueHelper.toImmutable((BaseValue) value))
                            .orElse(null);
                    if (oldImmutableValue == null && immutableValue == null) {
                        return DataTransactionResult.successNoData();
                    } else if (oldImmutableValue == null) {
                        return DataTransactionResult.successResult(immutableValue);
                    } else if (immutableValue == null) {
                        return DataTransactionResult.successRemove(oldImmutableValue);
                    } else {
                        return DataTransactionResult.successReplaceResult(immutableValue, oldImmutableValue);
                    }
                } else {
                    // TODO: Support immutable manipulators?
                    return DataTransactionResult.failNoData();
                }
            }
        }
    }

    return DataTransactionResult.failNoData();
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:51,代码来源:ICompositeValueStore.java

示例12: remove

import org.spongepowered.api.data.DataTransactionResult; //导入方法依赖的package包/类
@Override
default DataTransactionResult remove(Class<? extends H> containerClass) {
    return DataTransactionResult.failNoData();
}
 
开发者ID:LanternPowered,项目名称:LanternServer,代码行数:5,代码来源:ICompositeValueStore.java


注:本文中的org.spongepowered.api.data.DataTransactionResult.failNoData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。