= ObjectGraph _(record)_
:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Can be used to create diagrams (e.g. Plantuml)

== API

[source,java]
.ObjectGraph.java
----
record ObjectGraph {
  ObjectGraph()
  ObjectGraph create(ObjectGraph.@NonNull Factory factory)
  ObjectGraph transform(ObjectGraph.@Nullable Transformer transfomer)     // <.>
  String render(ObjectGraph.@Nullable Renderer renderer)
  DataSource asDiagramDslSource(ObjectGraph.@Nullable Renderer renderer)
  void writeDiagramDsl(ObjectGraph.@Nullable Renderer renderer, DataSink sink)
  void writeDiagramDsl(ObjectGraph.@Nullable Renderer renderer, File destinationDslFile)
  ObjectGraph copy()     // <.>
  GraphKernel kernel(ImmutableEnumSet<GraphCharacteristic> characteristics)     // <.>
  Map<String, List<ObjectGraph.Object>> objectsGroupedByPackage()     // <.>
  Map<String, ObjectGraph.Object> objectById()     // <.>
  ObjectGraph subGraph(int[] objectIndexes)     // <.>
}
----

<.> xref:#transform_ObjectGraph_Transformer[transform(ObjectGraph_Transformer)]
+
--
Passes a (deep clone) copy of this xref:refguide:applib:index/services/metamodel/objgraph/ObjectGraph.adoc[ObjectGraph] to given _Transformer_ and returns a transformed xref:refguide:applib:index/services/metamodel/objgraph/ObjectGraph.adoc[ObjectGraph] .
--
<.> xref:#copy_[copy()]
+
--
Returns a (deep clone) copy of this xref:refguide:applib:index/services/metamodel/objgraph/ObjectGraph.adoc[ObjectGraph] .
--
<.> xref:#kernel_ImmutableEnumSet[kernel(ImmutableEnumSet)]
+
--
Returns a _GraphKernel_ of given characteristics.
--
<.> xref:#objectsGroupedByPackage_[objectsGroupedByPackage()]
+
--
Returns objects grouped by package (as list-multimap).
--
<.> xref:#objectById_[objectById()]
+
--
Returns a _Map_ from object.id to _Object ObjectGraph.Object_
--
<.> xref:#subGraph_int[subGraph(int)]
+
--
Returns a sub-graph comprised only of object nodes as picked per zero based indexes _int[]_ .
--

== Members

[#transform_ObjectGraph_Transformer]
=== transform(ObjectGraph_Transformer)

Passes a (deep clone) copy of this xref:refguide:applib:index/services/metamodel/objgraph/ObjectGraph.adoc[ObjectGraph] to given _Transformer_ and returns a transformed xref:refguide:applib:index/services/metamodel/objgraph/ObjectGraph.adoc[ObjectGraph] .

Hence transformers are not required to create defensive copies.

[#copy_]
=== copy()

Returns a (deep clone) copy of this xref:refguide:applib:index/services/metamodel/objgraph/ObjectGraph.adoc[ObjectGraph] .

[#kernel_ImmutableEnumSet]
=== kernel(ImmutableEnumSet)

Returns a _GraphKernel_ of given characteristics.

[#objectsGroupedByPackage_]
=== objectsGroupedByPackage()

Returns objects grouped by package (as list-multimap).

[#objectById_]
=== objectById()

Returns a _Map_ from object.id to _Object ObjectGraph.Object_

[#subGraph_int]
=== subGraph(int)

Returns a sub-graph comprised only of object nodes as picked per zero based indexes _int[]_ .
