coral-beam/src/main/java/com/linkedin/beam/planner/CodeGenerator.java
Statement initStaticVars(List<MemberDeclaration> memberDeclarations) {
    final List<Statement> ifBodyStatements = new ArrayList<>();
    final Set<Expression> resourceFilesExprSet = new LinkedHashSet<>();
    final List<Statement> udfStatements = initPigUDFs(memberDeclarations, resourceFilesExprSet);

    // Then add statements to initialize Pig UDFs
    ifBodyStatements.addAll(udfStatements);

    // Wrap them with a guard to make sure they get initialized just once
    if (!ifBodyStatements.isEmpty()) {
      final ParameterExpression udfStaticInitCopyResourceDone = Expressions.parameter(boolean.class, "staticVarInit");
      memberDeclarations.add(0,
          Expressions.fieldDecl(Modifier.PRIVATE | Modifier.STATIC, udfStaticInitCopyResourceDone,
              Expressions.constant(false, boolean.class)));
      ifBodyStatements.add(Expressions.statement(
          Expressions.assign(udfStaticInitCopyResourceDone, Expressions.constant(true, boolean.class))));
      return Expressions.ifThen(Expressions.not(udfStaticInitCopyResourceDone), Expressions.block(ifBodyStatements));
    }
    return null;
  }
/**
   * Generates statements to initialize required static variables.
   */
Generates statements to initialize required static variables.
Generates statements to initialize required static variables .
Statement initStaticVars(List<MemberDeclaration> memberDeclarations) {
    final List<Statement> ifBodyStatements = new ArrayList<>();
    final Set<Expression> resourceFilesExprSet = new LinkedHashSet<>();
    final List<Statement> udfStatements = initPigUDFs(memberDeclarations, resourceFilesExprSet);
    ifBodyStatements.addAll(udfStatements);
    if (!ifBodyStatements.isEmpty()) {
      final ParameterExpression udfStaticInitCopyResourceDone = Expressions.parameter(boolean.class, "staticVarInit");
      memberDeclarations.add(0,
          Expressions.fieldDecl(Modifier.PRIVATE | Modifier.STATIC, udfStaticInitCopyResourceDone,
              Expressions.constant(false, boolean.class)));
      ifBodyStatements.add(Expressions.statement(
          Expressions.assign(udfStaticInitCopyResourceDone, Expressions.constant(true, boolean.class))));
      return Expressions.ifThen(Expressions.not(udfStaticInitCopyResourceDone), Expressions.block(ifBodyStatements));
    }
    return null;
  }
Statement initStaticVars ( List < MemberDeclaration > memberDeclarations ) { final List < Statement > ifBodyStatements = new ArrayList < > ( ) ; final Set < Expression > resourceFilesExprSet = new LinkedHashSet < > ( ) ; final List < Statement > udfStatements = initPigUDFs ( memberDeclarations , resourceFilesExprSet ) ; ifBodyStatements . addAll ( udfStatements ) ; if ( ! ifBodyStatements . isEmpty ( ) ) { final ParameterExpression udfStaticInitCopyResourceDone = Expressions . parameter ( boolean . class , "staticVarInit" ) ; memberDeclarations . add ( 0 , Expressions . fieldDecl ( Modifier . PRIVATE | Modifier . STATIC , udfStaticInitCopyResourceDone , Expressions . constant ( false , boolean . class ) ) ) ; ifBodyStatements . add ( Expressions . statement ( Expressions . assign ( udfStaticInitCopyResourceDone , Expressions . constant ( true , boolean . class ) ) ) ) ; return Expressions . ifThen ( Expressions . not ( udfStaticInitCopyResourceDone ) , Expressions . block ( ifBodyStatements ) ) ; } return null ; }
Generates statements to initialize required static variables.
Generates statements to initialize required static variables .
// Then add statements to initialize Pig UDFs // Wrap them with a guard to make sure they get initialized just once