JsonAnnotation


Source link: https://github.com/tianzhijiexian/JsonAnnotation

JsonAnnotation

JsonAnnotation can speed up Android development.
It generates gson model class by json string automatically and lets you concentrate on what's really important.

Demo

1.Copy url and json string into JsonAnnotation

2.Just write a jsonModel name

3.Build the project
(->Make Project)

Then you can use UserInfo to do something~

GIF Demo
Picture is big,wait a minute...

Usage

1.Add apt in project's build.gradle
[apt][ https://bitbucket.org/hvisser/android-apt]

 dependencies {

//...

classpath 'com.neenbedankt.gradle.plugins:android-apt:1.7'
  
}
 

2.Add apt plugin below apply plugin: 'com.android.application'

apply plugin: 'android-apt' 

3.add jsonAnnotation.jar in lib

Download Jar: https://github.com/tianzhijiexian/JsonAnnotation/blob/master/lib/build/libs/lib.jar

Question

@Json2Model(modelName = "UserInfo",jsonStr = "{
\n"

 + "
 \"id\": 100,\n"

 + "
 \"body\": \"It is my post\",\n"

 + "
 \"number\": 0.13,\n"

 + "
 \"created_at\": \"2014-05-22 19:12:38\"\n"

 + "
}
")
  String SEARCH_URSER_INFO = "search/user"; // api url

1. Why we need build project?
Unfortunately,Android does not(yet)understand the concept of a compile-time-only dependency, so you need to mess with your build files to make it work.

2. Efficiency
@Json2Model will run in compile-time and models are created before generate apk file.Using JsonAnnotation,developers can let it generate the plumbing code at compile time.Reflect is not in this project,you needn't worry about efficiency questions.

3. Where are models
@Json2Model will create models is out of your own project.You can find theme in:
app(your model name)/build/generated/source/apt/debug/...

You should edit these models by edit your jsonString.

JsonAnnotation is less than 40kb,try it now~

similar project: [ https://projectlombok.org/]

Developer


Jack Tony: [email protected]

zzz40500? [email protected]

License

Copyright 2015 Jack Tony  Licensed 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. 

Resources

This library help you to achieve popular tint effect from view.

A simple photo browser for Android applications.

RxObservableDiskCache is a library to save the results of Singles or single value Observables request on a local disk cache, so the next time the same request is called you get an immediate result.

Diagonalify is the library to create diagonal cut view on imageviews

A quick settings tile to quickly set the animator duration scale.

Now you can preserve object instance without any hassle during orientation change.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes