in.workarounds.bundler.compiler.helper.ParcelableArrayHelper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bundler-compiler Show documentation
Show all versions of bundler-compiler Show documentation
Compiler for bundler library
The newest version!
package in.workarounds.bundler.compiler.helper;
import com.squareup.javapoet.ArrayTypeName;
import com.squareup.javapoet.TypeName;
import javax.lang.model.util.Elements;
/**
* Created by madki on 22/10/15.
*/
public class ParcelableArrayHelper extends TypeHelper {
public ParcelableArrayHelper(TypeName typeName, Elements elementUtils) {
super(typeName);
if (!isParcelableArray(type, elementUtils)) {
throw new IllegalStateException("ParcelableArrayHelper used for a non ParcelableArray type");
}
}
@Override
public String getBundleMethodSuffix() {
return "ParcelableArray";
}
@Override
public boolean requiresCasting() {
return true;
}
public static boolean isParcelableArray(TypeName typeName, Elements elementUtils) {
return (typeName instanceof ArrayTypeName)
&&
TypeHelperFactory.isParcelable(
((ArrayTypeName) typeName).componentType,
elementUtils
);
}
}