Class MutableThing<B extends IImmutableThing>
- All Implemented Interfaces:
Builder<B>
,HasIRI
,PredicatesObjects
,PredicatesObjects.Builder<B>
,Thing
,Thing.Builder<B>
,ThingOrBuilder<B>
Thing
and its Thing.Builder
which is simple and mutable.
When build()
then it returns an IImmutableThing
copy of this (NOT itself).
This implementation is pretty inefficient, for both its runtime performance and memory
consumption, and should only be used "shortly lived"; prefer (building this into a) IImmutableThing
implementations, such as (typically) the ImmutableThing
or its generated
subclasses, for any objects that will be "kept around".
This implementation is not thread safe, obviously.
-
Nested Class Summary
Nested classes/interfaces inherited from interface dev.enola.thing.PredicatesObjects
PredicatesObjects.Builder<B extends PredicatesObjects>
Nested classes/interfaces inherited from interface dev.enola.thing.Thing
Thing.Builder<B extends Thing>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<@ImmutableTypeParameter T>
Thing.Builder<B> add
(HasPredicateIRI predicate, @ImmutableTypeParameter T value) <@ImmutableTypeParameter T>
Thing.Builder<B> add
(HasPredicateIRI predicate, @ImmutableTypeParameter T value, @Nullable String datatypeIRI) <@ImmutableTypeParameter T>
Thing.Builder<B> Adds one of possibly several value objects for the given predicate IRI.<@ImmutableTypeParameter T>
Thing.Builder<B> <@ImmutableTypeParameter T>
Thing.Builder<B> addAll
(HasPredicateIRI predicate, Iterable<@ImmutableTypeParameter T> value) <@ImmutableTypeParameter T>
Thing.Builder<B> addAll
(HasPredicateIRI predicate, Iterable<@ImmutableTypeParameter T> value, @Nullable String datatypeIRI) <@ImmutableTypeParameter T>
Thing.Builder<B> <@ImmutableTypeParameter T>
Thing.Builder<B> addAll
(String predicateIRI, Iterable<@ImmutableTypeParameter T> values, @Nullable String datatypeIRI) <@ImmutableTypeParameter T>
PredicatesObjects.Builder<B> addAllOrdered
(String predicateIRI, Iterable<@ImmutableTypeParameter T> values) <@ImmutableTypeParameter T>
Thing.Builder<B> addOrdered
(HasPredicateIRI predicate, @ImmutableTypeParameter T value) <@ImmutableTypeParameter T>
Thing.Builder<B> addOrdered
(HasPredicateIRI predicate, @ImmutableTypeParameter T value, @Nullable String datatypeIRI) <@ImmutableTypeParameter T>
Thing.Builder<B> addOrdered
(String predicateIRI, @ImmutableTypeParameter T value) Adds one of possibly several value objects for the given predicate IRI - and preserves order.<@ImmutableTypeParameter T>
Thing.Builder<B> addOrdered
(String predicateIRI, @ImmutableTypeParameter T value, @Nullable String datatypeIRI) build()
Thing.Builder
<? extends Thing> copy()
final boolean
final int
hashCode()
iri()
<@ImmutableTypeParameter T>
Thing.Builder<B> <@ImmutableTypeParameter T>
Thing.Builder<B> final String
toString()
Methods inherited from class dev.enola.thing.impl.MutablePredicatesObjects
datatype, datatypes, get, predicateIRIs, properties
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface dev.enola.thing.PredicatesObjects
datatype, datatype, datatypes, get, get, get, get, getLinks, getOptional, getString, getString, getThing, getThing, getThingOrThrow, getThings, getThings, getThings, getThings, hasLink, isIterable, isLinkObject, isOrdered, isStruct, predicateIRIs, properties
Methods inherited from interface dev.enola.thing.PredicatesObjects.Builder
addAllOrdered, set, set
-
Field Details
-
FACTORY
-
properties
-
datatypes
-
-
Constructor Details
-
MutableThing
public MutableThing() -
MutableThing
public MutableThing(int expectedSize)
-
-
Method Details
-
iri
- Specified by:
iri
in interfaceThing.Builder<B extends IImmutableThing>
-
iri
-
set
public <@ImmutableTypeParameter T> Thing.Builder<B> set(String predicateIRI, @ImmutableTypeParameter T value) - Specified by:
set
in interfacePredicatesObjects.Builder<B extends IImmutableThing>
- Specified by:
set
in interfaceThing.Builder<B extends IImmutableThing>
-
set
public <@ImmutableTypeParameter T> Thing.Builder<B> set(String predicateIRI, @ImmutableTypeParameter T value, @Nullable String datatypeIRI) - Specified by:
set
in interfacePredicatesObjects.Builder<B extends IImmutableThing>
- Specified by:
set
in interfaceThing.Builder<B extends IImmutableThing>
-
add
public <@ImmutableTypeParameter T> Thing.Builder<B> add(String predicateIRI, @ImmutableTypeParameter T value) Description copied from interface:PredicatesObjects.Builder
Adds one of possibly several value objects for the given predicate IRI.This is UNORDERED! Insertion order may NOT be preserved. Duplicates are not allowed and will cause an error (possibly only on
PredicatesObjects.Builder.build()
). It is an error if this property has already been set to anything else than aSet
.- Specified by:
add
in interfacePredicatesObjects.Builder<B extends IImmutableThing>
- Specified by:
add
in interfaceThing.Builder<B extends IImmutableThing>
-
addAll
public <@ImmutableTypeParameter T> Thing.Builder<B> addAll(String predicateIRI, Iterable<@ImmutableTypeParameter T> values) - Specified by:
addAll
in interfacePredicatesObjects.Builder<B extends IImmutableThing>
- Specified by:
addAll
in interfaceThing.Builder<B extends IImmutableThing>
-
add
public <@ImmutableTypeParameter T> Thing.Builder<B> add(String predicateIRI, @ImmutableTypeParameter T value, @Nullable String datatypeIRI) - Specified by:
add
in interfacePredicatesObjects.Builder<B extends IImmutableThing>
- Specified by:
add
in interfaceThing.Builder<B extends IImmutableThing>
-
addAll
public <@ImmutableTypeParameter T> Thing.Builder<B> addAll(String predicateIRI, Iterable<@ImmutableTypeParameter T> values, @Nullable String datatypeIRI) - Specified by:
addAll
in interfacePredicatesObjects.Builder<B extends IImmutableThing>
- Specified by:
addAll
in interfaceThing.Builder<B extends IImmutableThing>
-
addOrdered
public <@ImmutableTypeParameter T> Thing.Builder<B> addOrdered(String predicateIRI, @ImmutableTypeParameter T value) Description copied from interface:PredicatesObjects.Builder
Adds one of possibly several value objects for the given predicate IRI - and preserves order.Nota bene: This is ordered (insertion order is preserved), but not sorted (elements are in the order in which they were added, not [re-]sorted).
If this property has previously already been set to something other than a List, then it gets converted to a list (in a random order), and then values gets added.
Duplicates ARE allowed.
- Specified by:
addOrdered
in interfacePredicatesObjects.Builder<B extends IImmutableThing>
- Specified by:
addOrdered
in interfaceThing.Builder<B extends IImmutableThing>
-
addOrdered
public <@ImmutableTypeParameter T> Thing.Builder<B> addOrdered(String predicateIRI, @ImmutableTypeParameter T value, @Nullable String datatypeIRI) - Specified by:
addOrdered
in interfacePredicatesObjects.Builder<B extends IImmutableThing>
- Specified by:
addOrdered
in interfaceThing.Builder<B extends IImmutableThing>
-
add
public <@ImmutableTypeParameter T> Thing.Builder<B> add(HasPredicateIRI predicate, @ImmutableTypeParameter T value) - Specified by:
add
in interfacePredicatesObjects.Builder<B extends IImmutableThing>
- Specified by:
add
in interfaceThing.Builder<B extends IImmutableThing>
-
add
public <@ImmutableTypeParameter T> Thing.Builder<B> add(HasPredicateIRI predicate, @ImmutableTypeParameter T value, @Nullable String datatypeIRI) - Specified by:
add
in interfacePredicatesObjects.Builder<B extends IImmutableThing>
- Specified by:
add
in interfaceThing.Builder<B extends IImmutableThing>
-
addAll
public <@ImmutableTypeParameter T> Thing.Builder<B> addAll(HasPredicateIRI predicate, Iterable<@ImmutableTypeParameter T> value) - Specified by:
addAll
in interfacePredicatesObjects.Builder<B extends IImmutableThing>
- Specified by:
addAll
in interfaceThing.Builder<B extends IImmutableThing>
-
addAll
public <@ImmutableTypeParameter T> Thing.Builder<B> addAll(HasPredicateIRI predicate, Iterable<@ImmutableTypeParameter T> value, @Nullable String datatypeIRI) - Specified by:
addAll
in interfacePredicatesObjects.Builder<B extends IImmutableThing>
- Specified by:
addAll
in interfaceThing.Builder<B extends IImmutableThing>
-
addOrdered
public <@ImmutableTypeParameter T> Thing.Builder<B> addOrdered(HasPredicateIRI predicate, @ImmutableTypeParameter T value) - Specified by:
addOrdered
in interfacePredicatesObjects.Builder<B extends IImmutableThing>
- Specified by:
addOrdered
in interfaceThing.Builder<B extends IImmutableThing>
-
addOrdered
public <@ImmutableTypeParameter T> Thing.Builder<B> addOrdered(HasPredicateIRI predicate, @ImmutableTypeParameter T value, @Nullable String datatypeIRI) - Specified by:
addOrdered
in interfacePredicatesObjects.Builder<B extends IImmutableThing>
- Specified by:
addOrdered
in interfaceThing.Builder<B extends IImmutableThing>
-
copy
- Specified by:
copy
in interfacePredicatesObjects
- Specified by:
copy
in interfaceThing
- Overrides:
copy
in classMutablePredicatesObjects<B extends IImmutableThing>
-
hashCode
public final int hashCode()- Overrides:
hashCode
in classMutablePredicatesObjects<B extends IImmutableThing>
-
equals
- Overrides:
equals
in classMutablePredicatesObjects<B extends IImmutableThing>
-
toString
-
build
- Specified by:
build
in interfaceBuilder<B extends IImmutableThing>
- Specified by:
build
in interfacePredicatesObjects.Builder<B extends IImmutableThing>
- Specified by:
build
in interfaceThing.Builder<B extends IImmutableThing>
-
addAllOrdered
public <@ImmutableTypeParameter T> PredicatesObjects.Builder<B> addAllOrdered(String predicateIRI, Iterable<@ImmutableTypeParameter T> values) - Specified by:
addAllOrdered
in interfacePredicatesObjects.Builder<B extends IImmutablePredicatesObjects>
-