Hrisey


Source link: https://github.com/mg6maciej/hrisey

Hrisey

Boilerplate code suppressor tool for Android platform based on Project Lombok.

More details on available annotaions in wiki pages.

Current limitation: doesn't work with JDK 8. Any help resolving this issue is highly appreciated.

Usage

Add Hrisey as a dependency:

dependencies {

  provided 'pl.mg6.hrisey:hrisey:0.3.1' 
}

Install Hrisey Plugin in IntelliJ IDEA or Android Studio.

And then just start using it:

@hrisey.Parcelable class ParcelableClass implements android.os.Parcelable {

String myString; 
}

Note: adding implements android.os.Parcelable seems redundant, but is there only because of a limitation when using certain Jetbrains APIs. Hrisey will generate it if missing, but IDEA / Android Studio will not undestand it.

This will generate

class ParcelableClass implements android.os.Parcelable {

public static final android.os.Parcelable.Creator<ParcelableClass> CREATOR = new CreatorImpl();

String myString;

public int describeContents() {

return 0;
  
}

public void writeToParcel(android.os.Parcel dest, int flags) {

dest.writeString(this.myString);

  
}

protected ParcelableClass(android.os.Parcel source) {

this.myString = source.readString();

  
}

private static class CreatorImpl implements android.os.Parcelable.Creator<ParcelableClass> {

 public ParcelableClass createFromParcel(android.os.Parcel source) {

 return new ParcelableClass(source);

}

 public ParcelableClass[] newArray(int size) {

 return new ParcelableClass[size];

}

  
}
 
}

during preprocessing phase. You will never see this code again!

Optimization hint: when possible, add final to classes with @Parcelable annotation to avoid some reflection and storing unnecessary bits of data.

Why is Hrisey better?

Because it "adds" code to your classes. Other tools use JSR 269 to generate new classes, which leads to leaking abstraction in your code. Hrisey is transparent and can be technically removed from your project in a matter of minutes. But when you start using it, you will never think of doing so.

Why is Hrisey worse?

Because it "adds" code to your classes. You have to be careful not to put there too much logic yourself, because debugging might be more complicated.

About Lombok

Project Lombok makes java a spicier language by adding 'handlers' that know how to build and compile simple, boilerplate-free, not-quite-java code. See LICENSE for the Project Lombok license.

To start, run:

ant -projecthelp 

HINT: If you'd like to develop lombok in eclipse, run ant eclipse first. It creates the necessary project infrastructure and downloads dependencies. Note that, in order to run "LombokizedEclipse.launch", you need to have "Eclipse SDK" installed.

For a list of all authors, see the AUTHORS file.

Project Lombok was started by:

Reinier Zwitserloot
twitter: @surial
home: http://zwitserloot.com/

Roel Spilker
twitter: @rspilker

Resources

A circle progress bar with material design.

Imitation of Ali credit sesame "ring view".

GSON analog for serialization/deserialization of Java objects into HTML code and back.

Change color of words (or substrings) into a TextView.

FingerLock is a library designed to make fingerprint authentication an easy task for Android developers.

AllowMe simple library to handle Android M permissions easily.

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