Menu

LEX File Exchange
EA Support Files
SC4 Wikipedia
Network Addon Mod
Dependencies
Chat
Welcome, Guest. Please login or register.
Did you miss your activation email?

May 09, 2021, 09:12:42 PM

Login with username, password and session length

Author Topic: LEX4J - Java LEX API Wrapper  (Read 4325 times)

0 Members and 1 Guest are viewing this topic.

Offline CasperVg

  • Administrator
  • Forums Guru
  • *
  • Posts: 2888
  • Total likes: 436
  • Reputation: 47
  • CL:
    The Go-To Guy!!
LEX4J - Java LEX API Wrapper
« on: November 22, 2013, 10:20:15 AM »
Hi everyone,

After working on the new SC4Devotion LEX API, which allows easy access to the LEX functionality outside the SC4Devotion website for a fair bit, I decided to start building a Java LEX API Wrapper, which will abstract most of the lower level stuff (fetching the JSON, putting the results into Java beans, etc.) for you and allow you to focus on your LEX application only.

Example:
This is how you can get the profile for a user and print the full name:
Code: [Select]
        Auth auth = new Auth("username", "password");
        UserRoute route = new UserRoute(auth);
        User user = route.getUser();
        System.out.println(user.getFullname());

Source:
Source-code is available at the Github repository and is licensed under the GPLv2 License. Everyone who wants to help and contribute is free to do so of course.

Documentation/Javadoc:
Documentation in the form of Javadoc is available through Github Pages:
http://caspervg.github.io/SC4D-LEX4J

Releases:
v 0.5.0-beta: Click here to download

Usage instructions:
Add the "LEX4J.jar" and the dependencies in the /lib/ directory to your project. That's it ;)
« Last Edit: November 23, 2013, 04:19:28 AM by CasperVg »
Follow my SimCity 4 Let's play on YouTube

Offline CasperVg

  • Administrator
  • Forums Guru
  • *
  • Posts: 2888
  • Total likes: 436
  • Reputation: 47
  • CL:
    The Go-To Guy!!
Re: LEX4J - Java LEX API Wrapper - Release 0.5.0-beta
« Reply #1 on: November 23, 2013, 04:17:51 AM »
After some more testing and adding some extra features (it can grab the various LEX search categories now too) I have decided to release the first binary build (v0.5.0-beta) for people to experiment with.

It is available through a Github Release here: Click me!
« Last Edit: November 23, 2013, 04:21:03 AM by CasperVg »
Follow my SimCity 4 Let's play on YouTube

Offline CasperVg

  • Administrator
  • Forums Guru
  • *
  • Posts: 2888
  • Total likes: 436
  • Reputation: 47
  • CL:
    The Go-To Guy!!
LEX4J - Java LEX API Wrapper - Release v. 0.7
« Reply #2 on: August 05, 2014, 02:42:10 AM »
Version 0.7 of the LEX4J API Wrapper has been released. Changelog:

    v. 0.5 - Initial release
    v. 0.6 - Improved documentation for the search filters
    v. 0.7 - Switched to v2 LEX API, add support for new search query

You can also easily add LEX4J to your dependencies by adding this to your Maven pom.xml (or similar in Gradle, etc.)
Code: [Select]
<dependencies>
  ...
  <dependency>
      <groupId>net.caspervg.lex4j</groupId>
      <artifactId>LEX4J</artifactId>
      <version>0.7</version>
  </dependency>
  ...
</dependencies>
Follow my SimCity 4 Let's play on YouTube

Offline CasperVg

  • Administrator
  • Forums Guru
  • *
  • Posts: 2888
  • Total likes: 436
  • Reputation: 47
  • CL:
    The Go-To Guy!!
Re: LEX4J - Java LEX API Wrapper
« Reply #3 on: August 03, 2015, 11:15:23 AM »
Version 4.0 of the LEX4J API wrapper has been released. It adds compatibility for the recently released LEX API v4.
Follow my SimCity 4 Let's play on YouTube