Class MutableThing<B extends IImmutableThing>
- All Implemented Interfaces:
Builder<B>
,HasIRI
,PredicatesObjects
,PredicatesObjects.Builder<B>
,PredicatesObjects.Builder2<B>
,Thing
,Thing.Builder<B>
,Thing.Builder2<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>, PredicatesObjects.Builder2<B extends PredicatesObjects>
Nested classes/interfaces inherited from interface dev.enola.thing.Thing
Thing.Builder<B extends Thing>, Thing.Builder2<B extends Thing>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> Thing.Builder2
<B> Adds one of possibly several value objects for the given predicate IRI.<T> Thing.Builder2
<B> <T> Thing.Builder2
<B> <T> Thing.Builder2
<B> <T> Thing.Builder2
<B> addOrdered
(String predicateIRI, T value) Adds one of possibly several value objects for the given predicate IRI - and preserves order.<T> Thing.Builder2
<B> addOrdered
(String predicateIRI, T value, @Nullable String datatypeIRI) build()
Thing.Builder2
<? extends Thing> copy()
final boolean
final int
hashCode()
iri()
final String
toString()
Methods inherited from class dev.enola.thing.impl.MutablePredicatesObjects
datatype, datatypes, deepBuildInto, 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, getOptional, getOptional, getOptional, getString, getString, getThing, getThingOrThrow, getThings, getThings, hasLink, isIterable, isLinkObject, isOrdered, isStruct, predicateIRIs, properties
Methods inherited from interface dev.enola.thing.PredicatesObjects.Builder
set, set
Methods inherited from interface dev.enola.thing.Thing.Builder2
add, add, addAll, addAll, addOrdered, addOrdered
-
Field Details
-
FACTORY
-
-
Constructor Details
-
MutableThing
public MutableThing() -
MutableThing
public MutableThing(int expectedSize)
-
-
Method Details
-
iri
- Specified by:
iri
in interfaceThing.Builder<B extends IImmutableThing>
-
iri
-
set
- Specified by:
set
in interfacePredicatesObjects.Builder<B extends IImmutableThing>
- Specified by:
set
in interfaceThing.Builder<B extends IImmutableThing>
- Overrides:
set
in classMutablePredicatesObjects<B extends IImmutableThing>
-
set
- Specified by:
set
in interfacePredicatesObjects.Builder<B extends IImmutableThing>
- Specified by:
set
in interfaceThing.Builder<B extends IImmutableThing>
- Overrides:
set
in classMutablePredicatesObjects<B extends IImmutableThing>
-
add
Description copied from interface:PredicatesObjects.Builder2
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.Builder2.build()
). It is an error if this property has already been set to anything else than aSet
.- Specified by:
add
in interfacePredicatesObjects.Builder2<B extends IImmutableThing>
- Specified by:
add
in interfaceThing.Builder2<B extends IImmutableThing>
- Overrides:
add
in classMutablePredicatesObjects<B extends IImmutableThing>
-
add
- Specified by:
add
in interfacePredicatesObjects.Builder2<B extends IImmutableThing>
- Specified by:
add
in interfaceThing.Builder2<B extends IImmutableThing>
- Overrides:
add
in classMutablePredicatesObjects<B extends IImmutableThing>
-
addAll
- Specified by:
addAll
in interfacePredicatesObjects.Builder2<B extends IImmutableThing>
- Specified by:
addAll
in interfaceThing.Builder2<B extends IImmutableThing>
- Overrides:
addAll
in classMutablePredicatesObjects<B extends IImmutableThing>
-
add
- Specified by:
add
in interfacePredicatesObjects.Builder2<B extends IImmutableThing>
- Specified by:
add
in interfaceThing.Builder2<B extends IImmutableThing>
- Overrides:
add
in classMutablePredicatesObjects<B extends IImmutableThing>
-
addAll
public <T> Thing.Builder2<B> addAll(String predicateIRI, Iterable<T> value, @Nullable String datatypeIRI) - Specified by:
addAll
in interfacePredicatesObjects.Builder2<B extends IImmutableThing>
- Specified by:
addAll
in interfaceThing.Builder2<B extends IImmutableThing>
- Overrides:
addAll
in classMutablePredicatesObjects<B extends IImmutableThing>
-
addOrdered
Description copied from interface:PredicatesObjects.Builder2
Adds one of possibly several value objects for the given predicate IRI - and preserves order.Duplicates ARE allowed. It is an error if this property has already been set to anything else than a
List
.- Specified by:
addOrdered
in interfacePredicatesObjects.Builder2<B extends IImmutableThing>
- Specified by:
addOrdered
in interfaceThing.Builder2<B extends IImmutableThing>
- Overrides:
addOrdered
in classMutablePredicatesObjects<B extends IImmutableThing>
-
addOrdered
- Specified by:
addOrdered
in interfacePredicatesObjects.Builder2<B extends IImmutableThing>
- Specified by:
addOrdered
in interfaceThing.Builder2<B extends IImmutableThing>
- Overrides:
addOrdered
in classMutablePredicatesObjects<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
- Overrides:
toString
in classMutablePredicatesObjects<B extends IImmutableThing>
-
build
- Specified by:
build
in interfaceBuilder<B extends IImmutableThing>
- Specified by:
build
in interfacePredicatesObjects.Builder<B extends IImmutableThing>
- Specified by:
build
in interfacePredicatesObjects.Builder2<B extends IImmutableThing>
- Specified by:
build
in interfaceThing.Builder<B extends IImmutableThing>
- Overrides:
build
in classMutablePredicatesObjects<B extends IImmutableThing>
-