Object Graph

Simple library to traverse Java object graph with fluent configuration

Лицензия

Лицензия

Категории

Категории

Сеть
Группа

Группа

net.bramp.objectgraph
Идентификатор

Идентификатор

objectgraph
Последняя версия

Последняя версия

1.1.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

Object Graph
Simple library to traverse Java object graph with fluent configuration
Ссылка на сайт

Ссылка на сайт

https://github.com/bramp/objectgraph
Система контроля версий

Система контроля версий

https://github.com/bramp/objectgraph

Скачать objectgraph

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/net.bramp.objectgraph/objectgraph/ -->
<dependency>
    <groupId>net.bramp.objectgraph</groupId>
    <artifactId>objectgraph</artifactId>
    <version>1.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/net.bramp.objectgraph/objectgraph/
implementation 'net.bramp.objectgraph:objectgraph:1.1.0'
// https://jarcasting.com/artifacts/net.bramp.objectgraph/objectgraph/
implementation ("net.bramp.objectgraph:objectgraph:1.1.0")
'net.bramp.objectgraph:objectgraph:jar:1.1.0'
<dependency org="net.bramp.objectgraph" name="objectgraph" rev="1.1.0">
  <artifact name="objectgraph" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.bramp.objectgraph', module='objectgraph', version='1.1.0')
)
libraryDependencies += "net.bramp.objectgraph" % "objectgraph" % "1.1.0"
[net.bramp.objectgraph/objectgraph "1.1.0"]

Зависимости

provided (1)

Идентификатор библиотеки Тип Версия
com.google.errorprone : error_prone_annotations jar 2.0.19

test (3)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12
com.google.guava : guava jar 21.0
org.assertj : assertj-core jar 3.7.0

Модули Проекта

Данный проект не имеет модулей.

objectgraph

by Andrew Brampton 2014,2016

Java Build Status Maven

Simple library to traverse Java object graph. A breadth-first search is conducted on each field of each object encountered. No object is visited twice, and the algorithm is array based, so does not encounter stack overflow issues.

Maven

<dependency>
	<groupId>net.bramp.objectgraph</groupId>
	<artifactId>objectgraph</artifactId>
	<version>1.1.0</version>
</dependency>

or for Java 1.6

<dependency>
	<groupId>net.bramp.objectgraph</groupId>
	<artifactId>objectgraph</artifactId>
	<version>1.0.3</version>
</dependency>

Example

ObjectGraph
    .visitor(new ObjectGraph.Visitor() {
	    @Override
	    public boolean visit(Object object, Class clazz) {
		    System.out.println("visited " + object.toString());
		    return false;
	    }
    })
    .excludeStatic()
    .excludeTransient()
    .traverse( myObject );

Use Cases

We were encountering an issue where Hibernate entities were accidentally being stored in a HTTP session. This can cause a number of issues. To help alert new developers to this issue, a Servlet filter was created that during development would search the session for any Hibernate entities. If a entity was found, a friendly message would be displayed to encourage the developer to fix the problem.

This library has numerous other uses cases, however, in its current form the API is not well suited for serialising a object graph

Build and Release

To build this project use mvn.

To push a release to maven central use the standard maven release plugin, and Sonatype's OSS repo:

mvn release:prepare
mvn release:perform

Licence

Copyright (c) 2014,2016, Andrew Brampton
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

* Redistributions of source code must retain the above copyright notice, this
  list of conditions and the following disclaimer.

* Redistributions in binary form must reproduce the above copyright notice,
  this list of conditions and the following disclaimer in the documentation
  and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Версии библиотеки

Версия
1.1.0
1.0.3
1.0.2
1.0.1
1.0