Class AttributeMap.Builder

    • Method Detail

      • get

        public <T> T get​(AttributeMap.Key<T> key)
        Get the value for the provided key.
      • computeIfAbsent

        public <T> T computeIfAbsent​(AttributeMap.Key<T> key,
                                     Supplier<T> valueIfAbsent)
        Add a mapping between the provided key and value, if the current value for the key is null. Returns the value.
      • putLazy

        public <T> AttributeMap.Builder putLazy​(AttributeMap.Key<T> key,
                                                AttributeMap.LazyValue<T> lazyValue)
        Add a mapping between the provided key and value provider. The lazy value will only be resolved when the value is needed. During resolution, the lazy value is provided with a value reader. The value reader will fail if the reader attempts to read its own value (directly, or indirectly through other lazy values). If a value is updated that a lazy value is depended on, the lazy value will be re-resolved the next time the lazy value is accessed.
      • putAll

        public AttributeMap.Builder putAll​(Map<? extends AttributeMap.Key<?>,​?> attributes)
        Adds all the attributes from the map provided. This is not type safe, and will throw an exception during creation if a value in the map is not of the correct type for its key.
      • putAll

        public AttributeMap.Builder putAll​(AttributeMap attributes)
        Put all of the attributes from the provided map into this one. This will resolve lazy attributes and store their value as a constant, so this should only be used when the source attributes are constants or it's okay that the values will no longer be lazy.