workday / postman Goto Github PK
View Code? Open in Web Editor NEWA library that implements Parcelable for you.
License: MIT License
A library that implements Parcelable for you.
License: MIT License
This seems like something that it should be able to handle since Enums are serializable.
This library includes all of commons-lang
because of one single usage in capitalizing String input. Since the library footprint of commons-lang
, with its roundabout 3000 methods, is comparatively big in relation to its usefulness in Postman, I am proposing to get rid of the dependency and roll our own implementation of StringUtils.capitalize().
I have two classes:
@Parceled
public class A implements Parcelable {
public static final Creator<A> CREATOR = Postman.getCreator(A.class);
State mState;
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
Postman.writeToParcel(this, dest);
}
@Parceled
public static class State implements Parcelable {
public static final Creator<State> CREATOR = Postman.getCreator(State.class);
// Postman Fields
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
Postman.writeToParcel(this, dest);
}
}
}
and
@Parceled
public class B extends A implements Parcelable {
public static final Creator<B> CREATOR = Postman.getCreator(B.class);
State mState
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
Postman.writeToParcel(this, dest);
}
@Parceled
public static class State extends A.State implements Parcelable {
public static final Creator<State> CREATOR = Postman.getCreator(State.class);
// Postman Fields
@Override
public int describeContents() {
return 0;
}
@Override
public void writeToParcel(Parcel dest, int flags) {
Postman.writeToParcel(this, dest);
}
}
}
As far as I can tell the State$$Parceler only handles its own fields, but the B$$Parceler seems to be setting the State field twice. Once I assume is for the A.State field and the other for the B.State field.
public final class B$State$$Parceler implements Parceler<B.State> {
@Override
public void writeToParcel(B.State object, Parcel dest) {
Bundle bundle = new Bundle();
bundle.putInt("mSomeCustomField", object.mSomeCustomField);
dest.writeBundle(bundle);
}
@Override
public B.State readFromParcel(Parcel parcel) {
B.State object = new B.State();
Bundle bundle = parcel.readBundle();
bundle.setClassLoader(B.State.class.getClassLoader());
object.mCurrentManaCost = bundle.getInt("mCurrentManaCost");
return object;
}
@Override
public B.State[] newArray(int size) {
return new B.State[size];
}
}
public final class B$$Parceler implements Parceler<B> {
@Override
public void writeToParcel(B object, Parcel dest) {
Bundle bundle = new Bundle();
bundle.putParcelable("mState", object.mState);
bundle.putParcelable("mState", object.mState);
dest.writeBundle(bundle);
}
@Override
public Commander readFromParcel(Parcel parcel) {
B object = new B();
Bundle bundle = parcel.readBundle();
bundle.setClassLoader(B.class.getClassLoader());
object.mState = bundle.getParcelable("mState");
object.mState = bundle.getParcelable("mState");
return object;
}
@Override
public B[] newArray(int size) {
return new B[size];
}
}
Can you explain how these parcelers handle class hierarchy and if this is a problem?
like every other Android library out there.
I upgraded to version 1.3 and the parcelers disappear. When I downgrade to 1.2 they reappear. Makes me believe the processor isn't running in 1.3, or something changed that is causing the processor to not run on my particular build.
../../../../../../.gradle/caches/modules-2/files-2.1/com.workday/postman/1.1/ee8f2b1ed06368a16d962ee20e5ab4ae6c8dc3ec/postman-1.1.jar: Invalid package reference in library; not included in Android: javax.tools. Referenced from com.workday.postman.codegen.ParcelerGenerator.
Priority: 6 / 10
Category: Correctness
Severity: Error
Explanation: Package not included in Android.
This library includes a dependency on javawriter
for its compile-time code generation. Since there is only one artifact to include for both the processor and core, this dependency is shipped in the final package as well. Please consider splitting up the library into two separate modules, to have inclusion work akin to other code generation libraries, like so:
compile "com.github.Workday:postman:<version>"
apt "com.github.Workday:postman-processor:<version>"
Only the processor module would then require the dependency on javawriter.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.