org.parceler.Parcel Java Examples

The following examples show how to use org.parceler.Parcel. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ParcelTransactionWorker.java    From parceler with Apache License 2.0 5 votes vote down vote up
@Override
public Void innerRun(Provider<ASTType> valueProvider) {

    ASTType value = valueProvider.get();
    ASTAnnotation parcelASTAnnotation = value.getASTAnnotation(Parcel.class);

    ParcelableDescriptor analysis = parcelableAnalysis.analyze(value, parcelASTAnnotation);

    if(analysis != null) {
        parcelableGenerator.generateParcelable(value, analysis);
    }
    return null;
}
 
Example #2
Source File: ParcelProcessor.java    From parceler with Apache License 2.0 5 votes vote down vote up
public void submit(Class<? extends Annotation> annotation, Collection<Provider<ASTType>> parcelProviders) {
    for (Provider<ASTType> parcelProvider : parcelProviders) {
        if(annotation == ParcelClass.class || annotation == ParcelClasses.class){
            externalParcelRepositoryProcessor.submit(scopedTransactionBuilder.build(parcelProvider, externalParcelRepositoryTransactionWorkerProvider));
            externalParcelProcessor.submit(scopedTransactionBuilder.build(parcelProvider, externalParcelTransactionWorkerProvider));
        }
        if(annotation == Parcel.class){
            parcelProcessor.submit(scopedTransactionBuilder.build(parcelProvider, parcelTransactionWorkerProvider));
        }
    }
}
 
Example #3
Source File: ExternalParcelTransactionWorker.java    From parceler with Apache License 2.0 5 votes vote down vote up
private void analyze(ASTAnnotation astAnnotation){
    ASTType parcelType = astAnnotation.getProperty("value", ASTType.class);
    if(!analyzed.contains(parcelType)) {
        analyzed.add(parcelType);
        ASTAnnotation parcelASTAnnotation = astAnnotation.getProperty("annotation", ASTAnnotation.class);
        if (parcelASTAnnotation == null) {
            parcelASTAnnotation = parcelType.getASTAnnotation(Parcel.class);
        }
        ParcelableDescriptor analysis = parcelableAnalysis.analyze(parcelType, parcelASTAnnotation);
        if (analysis != null) {
            parcelableGenerator.generateParcelable(parcelType, analysis);
        }
    }
}
 
Example #4
Source File: Review.java    From udacity-p1-p2-popular-movies with MIT License 4 votes vote down vote up
@Override
public void itemToParcel(Review input, android.os.Parcel parcel) {
    parcel.writeParcelable(Parcels.wrap(Review.class, input), 0);
}
 
Example #5
Source File: Review.java    From udacity-p1-p2-popular-movies with MIT License 4 votes vote down vote up
@Override
public Review itemFromParcel(android.os.Parcel parcel) {
    return Parcels.unwrap(parcel.readParcelable(Review.class.getClassLoader()));
}
 
Example #6
Source File: Video.java    From udacity-p1-p2-popular-movies with MIT License 4 votes vote down vote up
@Override
public void itemToParcel(Video input, android.os.Parcel parcel) {
    parcel.writeParcelable(Parcels.wrap(Video.class, input), 0);
}
 
Example #7
Source File: Video.java    From udacity-p1-p2-popular-movies with MIT License 4 votes vote down vote up
@Override
public Video itemFromParcel(android.os.Parcel parcel) {
    return Parcels.unwrap(parcel.readParcelable(Video.class.getClassLoader()));
}
 
Example #8
Source File: DateConverter.java    From parceler with Apache License 2.0 4 votes vote down vote up
@Override
public void toParcel(Date input, android.os.Parcel parcel) {
    parcel.writeLong(input.getTime());
}
 
Example #9
Source File: DateConverter.java    From parceler with Apache License 2.0 4 votes vote down vote up
@Override
public Date fromParcel(android.os.Parcel parcel) {
    return new Date(parcel.readLong());
}