gwt-jackson :: Extensions :: Guava

Extension to support Guava types like Optional or ImmutableSet

Лицензия

Лицензия

Категории

Категории

GWT (Google Web Toolkit) Взаимодействие с пользователем Веб-фреймворки Jackson Данные JSON Guava Универсальные библиотеки Utility
Группа

Группа

com.github.nmorel.gwtjackson
Идентификатор

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

gwt-jackson-guava
Последняя версия

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

0.15.4
Дата

Дата

Тип

Тип

jar
Описание

Описание

gwt-jackson :: Extensions :: Guava
Extension to support Guava types like Optional or ImmutableSet

Скачать gwt-jackson-guava

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

<!-- https://jarcasting.com/artifacts/com.github.nmorel.gwtjackson/gwt-jackson-guava/ -->
<dependency>
    <groupId>com.github.nmorel.gwtjackson</groupId>
    <artifactId>gwt-jackson-guava</artifactId>
    <version>0.15.4</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.nmorel.gwtjackson/gwt-jackson-guava/
implementation 'com.github.nmorel.gwtjackson:gwt-jackson-guava:0.15.4'
// https://jarcasting.com/artifacts/com.github.nmorel.gwtjackson/gwt-jackson-guava/
implementation ("com.github.nmorel.gwtjackson:gwt-jackson-guava:0.15.4")
'com.github.nmorel.gwtjackson:gwt-jackson-guava:jar:0.15.4'
<dependency org="com.github.nmorel.gwtjackson" name="gwt-jackson-guava" rev="0.15.4">
  <artifact name="gwt-jackson-guava" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.nmorel.gwtjackson', module='gwt-jackson-guava', version='0.15.4')
)
libraryDependencies += "com.github.nmorel.gwtjackson" % "gwt-jackson-guava" % "0.15.4"
[com.github.nmorel.gwtjackson/gwt-jackson-guava "0.15.4"]

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
com.google.guava : guava-gwt jar 19.0

provided (3)

Идентификатор библиотеки Тип Версия
com.google.gwt : gwt-user jar 2.7.0
com.google.gwt : gwt-dev jar 2.7.0
com.github.nmorel.gwtjackson : gwt-jackson jar 0.15.4

test (4)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12
com.fasterxml.jackson.core : jackson-databind jar 2.9.6
com.fasterxml.jackson.datatype : jackson-datatype-guava jar 2.9.6
com.github.nmorel.gwtjackson : gwt-jackson test-jar 0.15.4

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

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

gwt-jackson Build Status

gwt-jackson is a JSON parser for GWT. It uses Jackson 2.x annotations to customize the serialization/deserialization process.

Most of the Jackson 2.x annotations are supported. You can find an up-to-date list here. You can also find a lot of use cases in the tests.

Jackson 1.x annotations (org.codehaus.jackson.*) are not supported.

Check the wiki for more informations.

Quick start

Add <inherits name="com.github.nmorel.gwtjackson.GwtJackson" /> to your module descriptor XML file.

Then just create an interface extending ObjectReader, ObjectWriter or ObjectMapper if you want to read JSON, write an object to JSON or both.

Here's an example without annotation :

public class TestEntryPoint implements EntryPoint {

    public static interface PersonMapper extends ObjectMapper<Person> {}

    public static class Person {

        private String firstName;
        private String lastName;

        public String getFirstName() {
            return firstName;
        }

        public void setFirstName(String firstName) {
            this.firstName = firstName;
        }

        public String getLastName() {
            return lastName;
        }

        public void setLastName(String lastName) {
            this.lastName = lastName;
        }
    }

    @Override
    public void onModuleLoad() {
        PersonMapper mapper = GWT.create( PersonMapper.class );

        String json = mapper.write( new Person( "John", "Doe" ) );
        GWT.log( json ); // > {"firstName":"John","lastName":"Doe"}

        Person person = mapper.read( json );
        GWT.log( person.getFirstName() + " " + person.getLastName() ); // > John Doe
    }
}

And if you want to make your class immutable for example, you can add some Jackson annotations :

public class TestEntryPoint implements EntryPoint {

    public static interface PersonMapper extends ObjectMapper<Person> {}

    public static class Person {

        private final String firstName;
        private final String lastName;

        @JsonCreator
        public Person( @JsonProperty( "firstName" ) String firstName,
                       @JsonProperty( "lastName" ) String lastName ) {
            this.firstName = firstName;
            this.lastName = lastName;
        }

        public String getFirstName() {
            return firstName;
        }

        public String getLastName() {
            return lastName;
        }
    }

    @Override
    public void onModuleLoad() {
        PersonMapper mapper = GWT.create( PersonMapper.class );

        String json = mapper.write( new Person( "John", "Doe" ) );
        GWT.log( json ); // > {"firstName":"John","lastName":"Doe"}

        Person person = mapper.read( json );
        GWT.log( person.getFirstName() + " " + person.getLastName() ); // > John Doe
    }
}

With Maven

<dependency>
  <groupId>com.github.nmorel.gwtjackson</groupId>
  <artifactId>gwt-jackson</artifactId>
  <version>0.15.4</version>
  <scope>provided</scope>
</dependency>

You can also get maven snapshots using the following repository :

<repository>
  <id>oss-sonatype-snapshots</id>
  <url>https://oss.sonatype.org/content/repositories/snapshots</url>
  <snapshots>
    <enabled>true</enabled>
  </snapshots>
</repository>

Without Maven

In addition of gwt-jackson jar you can find here, you also need

Server communication

If you need to communicate with your server using REST/Json payload, you can check these framework which integrates gwt-jackson :

Copyright and license

Copyright 2014 Nicolas Morel under the Apache 2.0 license.

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

Версия
0.15.4
0.15.3
0.15.2
0.15.1
0.15.0
0.14.2
0.14.1
0.13.0
0.12.0
0.11.1
0.11.0
0.10.0
0.9.0
0.8.0
0.7.0
0.6.2
0.6.1
0.6.0
0.5.0
0.4.0
0.3.0