コード例 #1
0
  private void writePostCreateChildMethodCalls(
      VariableElement field,
      TypeMirror itemType,
      Collection<ExecutableElement> postCreateChildMethods,
      JavaWriter writer)
      throws IOException {

    if (!postCreateChildMethods.isEmpty() && metaTypes.isSubtype(itemType, Names.PARCELABLE)) {
      writer.beginControlFlow("for (Object child : object.%s)", field.getSimpleName());
      for (ExecutableElement method : postCreateChildMethods) {
        writer.emitStatement("object.%s(child)", method.getSimpleName());
      }
      writer.endControlFlow();
    }
  }
コード例 #2
0
 @Override
 public boolean isApplicable(VariableElement field) {
   return metaTypes.isSubtypeErasure(field.asType(), Collection.class);
 }