@SuppressWarnings("unchecked") @Override public Value<T> type() { return Sponge.getRegistry().getValueFactory().createValue((Key<Value<T>>) this.usedKey, this.value, this.defaultValue); }
@SuppressWarnings("unchecked") @Override protected Value<Boolean> getValueGetter() { return Sponge.getRegistry().getValueFactory().createValue((Key<Value<Boolean>>) this.usedKey, this.value, this.defaultValue); }
@SuppressWarnings("unchecked") @Override protected Value<E> getValueGetter() { return Sponge.getRegistry().getValueFactory().createValue((Key<Value<E>>) this.usedKey, this.value, this.defaultValue); } }
private AbstractImmutableListData(List<E> value, @Nullable List<E> defaultValue, Key<ListValue<E>> usedKey) { super(usedKey, value, defaultValue == null ? value : defaultValue); this.listValue = Sponge.getRegistry().getValueFactory().createListValue(usedKey, value, this.defaultValue).asImmutable(); }
private AbstractImmutableMappedData(Map<K, V> value, @Nullable Map<K, V> defaultValue, Key<MapValue<K, V>> usedKey) { super(usedKey, value, defaultValue == null ? value : defaultValue); this.mapValue = Sponge.getRegistry().getValueFactory().createMapValue(usedKey, value, this.defaultValue).asImmutable(); }
protected AbstractImmutableBooleanData(Key<Value<Boolean>> usedKey, boolean value, boolean defaultValue) { super(usedKey, value, defaultValue); this.immutableValue = Sponge.getRegistry().getValueFactory().createValue(usedKey, value, defaultValue).asImmutable(); }
protected AbstractImmutableSingleCatalogData(Key<Value<E>> usedKey, E value, E defaultValue) { super(usedKey, value, defaultValue); this.cachedValue = Sponge.getRegistry().getValueFactory() .createValue(usedKey, value, defaultValue) .asImmutable(); }
protected AbstractImmutableSingleEnumData(Key<Value<E>> usedKey, E value, E defaultValue) { super(usedKey, value, defaultValue); this.cachedValue = Sponge.getRegistry().getValueFactory().createValue(usedKey, value, defaultValue).asImmutable(); }
@Override protected MapValue<K, V> getValueGetter() { return Sponge.getRegistry().getValueFactory().createMapValue( (Key<MapValue<K, V>>) this.usedKey, getValue(), CollectionUtils.copyMap(this.defaultValue)); }
@Override protected ListValue<E> getValueGetter() { return Sponge.getRegistry().getValueFactory().createListValue( (Key<ListValue<E>>) this.usedKey, getValue(), CollectionUtils.copyList(this.defaultValue)); }
protected AbstractImmutableBoundedComparableData(Key<MutableBoundedValue<T>> usedKey, T value, T defaultValue, T lowerBound, T upperBound, Comparator<T> comparator) { super(usedKey, value, defaultValue); this.comparator = checkNotNull(comparator, "comparator"); this.lowerBound = checkNotNull(lowerBound, "lowerBound"); this.upperBound = checkNotNull(upperBound, "upperBound"); checkValue(value, "value"); checkValue(defaultValue, "defaultValue"); this.defaultValue = defaultValue; this.immutableBoundedValue = Sponge.getRegistry().getValueFactory() .createBoundedValueBuilder(usedKey) .defaultValue(defaultValue) .actualValue(value) .minimum(lowerBound) .maximum(upperBound) .comparator(comparator) .build() .asImmutable(); }
@SuppressWarnings("unchecked") @Override protected MutableBoundedValue<T> getValueGetter() { return Sponge.getRegistry().getValueFactory() .createBoundedValueBuilder((Key<MutableBoundedValue<T>>) this.usedKey) .defaultValue(this.defaultValue) .comparator(this.comparator) .minimum(this.lowerBound) .maximum(this.upperBound) .actualValue(getValue()) .build(); }
@Override public MapValue<String, Home> homes() { return Sponge.getRegistry().getValueFactory() .createMapValue(MyHomes.HOMES, this.homes, ImmutableMap.of()); }
@Override public Value<Home> defaultHome() { return Sponge.getRegistry().getValueFactory() .createValue(MyHomes.DEFAULT_HOME, this.defaultHome, null); }
public ImmutableHomeDataImpl(Home defaultHome, Map<String, Home> homes) { this.defaultHome = checkNotNull(defaultHome); this.homes = ImmutableMap.copyOf(checkNotNull(homes)); this.defaultHomeValue = Sponge.getRegistry().getValueFactory() .createValue(MyHomes.DEFAULT_HOME, defaultHome) .asImmutable(); this.homesValue = Sponge.getRegistry().getValueFactory() .createMapValue(MyHomes.HOMES, homes, ImmutableMap.of()) .asImmutable(); this.registerGetters(); }
@SuppressWarnings("unchecked") protected AbstractImmutableListData(List<E> value, Key<? extends BaseValue<List<E>>> usedKey) { super(ImmutableList.copyOf(value), usedKey); this.listValue = Sponge.getRegistry().getValueFactory().createListValue((Key<ListValue<E>>) this.usedKey, this.value).asImmutable(); }
@Override protected ImmutableValue<Long> getValueGetter() { return Sponge.getRegistry().getValueFactory() .createValue(CraftBookKeys.BLOCK_BAG, getValue()) .asImmutable(); }
@Override protected ImmutableValue<String> getValueGetter() { return Sponge.getRegistry().getValueFactory() .createValue(CraftBookKeys.NAMESPACE, getValue()) .asImmutable(); }
@Override protected ImmutableValue<ItemStackSnapshot> getValueGetter() { return Sponge.getRegistry().getValueFactory() .createValue(CraftBookKeys.KEY_LOCK, getValue()) .asImmutable(); }
@SuppressWarnings("unchecked") @Override protected MutableBoundedValue<T> getValueGetter() { return Sponge.getRegistry().getValueFactory() .createBoundedValueBuilder((Key<MutableBoundedValue<T>>) this.usedKey) .defaultValue(this.defaultValue) .comparator(this.comparator) .minimum(this.lowerBound) .maximum(this.upperBound) .actualValue(this.getValue()) .build(); }