Construct a new ConstructorBuilder.

@param context  the build context.
@param typeElement the class whoses members are being documented.
@param writer the doclet specific writer.
@return the new ConstructorBuilder
557108
public static ConstructorBuilder getInstance(Context context,
            TypeElement typeElement, ConstructorWriter writer) {
        return new ConstructorBuilder(context, typeElement, writer);
    }
468341
public static MemberSummaryBuilder getInstance(
            ClassWriter classWriter, Context context)
            throws Exception {
        MemberSummaryBuilder builder = new MemberSummaryBuilder(context,
                classWriter.getClassDoc());
        builder.memberSummaryWriters =
                new MemberSummaryWriter[VisibleMemberMap.NUM_MEMBER_TYPES];
        WriterFactory wf = context.configuration.getWriterFactory();
        for (int i = 0; i < VisibleMemberMap.NUM_MEMBER_TYPES; i++) {
                builder.memberSummaryWriters[i] =
                    builder.visibleMemberMaps[i].noVisibleMembers() ?
                        null :
                        wf.getMemberSummaryWriter(classWriter, i);
        }
        return builder;
    }
821320
public AbstractBuilder getPropertyBuilder(ClassWriter classWriter) throws Exception {
        final PropertyWriter propertyWriter =
                writerFactory.getPropertyWriter(classWriter);
        return PropertyBuilder.getInstance(context,
                                           classWriter.getClassDoc(),
                                           propertyWriter);
    }
178635
public AbstractBuilder getAnnotationTypeFieldsBuilder(
            AnnotationTypeWriter annotationTypeWriter)
    throws Exception {
        return AnnotationTypeFieldBuilder.getInstance(context,
            annotationTypeWriter.getAnnotationTypeDoc(),
            writerFactory.getAnnotationTypeFieldWriter(
                annotationTypeWriter));
    }
650922
public void generatePojos(BuilderContext builderContext, Set<TypeDef> buildables) {
        Set<TypeDef> additonalBuildables = new HashSet<>();
        Set<TypeDef> additionalTypes = new HashSet<>();
        for (TypeDef typeDef : buildables) {
            try {
                if (typeDef.isInterface() || typeDef.isAnnotation()) {
                    typeDef = ClazzAs.POJO.apply(typeDef);
                    builderContext.getDefinitionRepository().register(typeDef);
                    builderContext.getBuildableRepository().register(typeDef);
                    generateFromResources(typeDef,
                            Constants.DEFAULT_SOURCEFILE_TEMPLATE_LOCATION);
                    additonalBuildables.add(typeDef);

                    if (typeDef.hasAttribute(ADDITIONAL_BUILDABLES)) {
                        for (TypeDef also : typeDef.getAttribute(ADDITIONAL_BUILDABLES)) {
                             builderContext.getDefinitionRepository().register(also);
                             builderContext.getBuildableRepository().register(also);
                             generateFromResources(also, Constants.DEFAULT_SOURCEFILE_TEMPLATE_LOCATION);
                             additonalBuildables.add(also);
                        }
                    }

                    if (typeDef.hasAttribute(ADDITIONAL_TYPES)) {
                        for (TypeDef also : typeDef.getAttribute(ADDITIONAL_TYPES)) {
                             builderContext.getDefinitionRepository().register(also);
                            generateFromResources(also, Constants.DEFAULT_SOURCEFILE_TEMPLATE_LOCATION);
                            additionalTypes.add(also);
                        }
                    }
                }
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
        generateBuildables(builderContext, additonalBuildables);
    }
561669
private void buildConstructor( TypeSpec.Builder typeBuilder ) {
        MethodSpec.Builder constructorBuilder = MethodSpec.constructorBuilder().addModifiers( Modifier.PUBLIC );

        if ( !beanInfo.getParameterizedTypes().isEmpty() ) {
            Class mapperClass;
            String mapperNameFormat;
            if ( isSerializer() ) {
                mapperClass = Serializer.class;
                mapperNameFormat = TYPE_PARAMETER_SERIALIZER_FIELD_NAME;
            } else {
                mapperClass = Deserializer.class;
                mapperNameFormat = TYPE_PARAMETER_DESERIALIZER_FIELD_NAME;
            }

            for ( int i = 0; i < beanInfo.getParameterizedTypes().size(); i++ ) {
                JClassType argType = beanInfo.getParameterizedTypes().get( i );
                String mapperName = String.format( mapperNameFormat, i );
                TypeName mapperType = parameterizedName( mapperClass, argType );

                FieldSpec field = FieldSpec.builder( mapperType, mapperName, Modifier.PRIVATE, Modifier.FINAL ).build();
                typeBuilder.addField( field );

                ParameterSpec parameter = ParameterSpec.builder( mapperType, mapperName ).build();
                constructorBuilder.addParameter( parameter );
                constructorBuilder.addStatement( "this.$N = $N", field, parameter );
            }
        }

        typeBuilder.addMethod( constructorBuilder.build() );
    }
634133
protected void _generate(SarlConstructor constructor, PyAppendable it, IExtraLanguageGeneratorContext context) {
		if (constructor.isStatic()) {
			generateExecutable("___static_init___", constructor, false, false, null, //$NON-NLS-1$
					getTypeBuilder().getDocumentation(constructor),
					it, context);
			it.newLine().append("___static_init___()"); //$NON-NLS-1$
		} else {
			generateExecutable("__init__", constructor, true, false, null, //$NON-NLS-1$
					getTypeBuilder().getDocumentation(constructor),
					it, context);
		}
	}
525462
public void build(BuildContext context,
                      BuildUtils utils,
                      RuleConditionElement rce) {
        final EntryPointId entry = (EntryPointId) rce;
        context.setCurrentEntryPoint( entry );
        
        EntryPointNode epn = context.getKnowledgeBase().getRete().getEntryPointNode( entry );
        if( epn == null ) {
            NodeFactory nFactory = context.getComponentFactory().getNodeFactoryService();
            context.setObjectSource( utils.attachNode( context,
                                                       nFactory.buildEntryPointNode( context.getNextId(),
                                                                                     context.getKnowledgeBase().getRete(),
                                                                                     context ) ) );
        } else {
            context.setObjectSource( epn );
        }
     }
508480
public static MethodBuilder getInstance(Context context,
            TypeElement typeElement, MethodWriter writer) {
        return new MethodBuilder(context, typeElement, writer);
    }
667178
public AbstractBuilder getAnnotationTypeOptionalMemberBuilder(
            AnnotationTypeWriter annotationTypeWriter)
    throws Exception {
        return AnnotationTypeOptionalMemberBuilder.getInstance(context,
            annotationTypeWriter.getAnnotationTypeDoc(),
            writerFactory.getAnnotationTypeOptionalMemberWriter(
                annotationTypeWriter));
    }
171611
public void writeBindingContext(SourceWriter writer, Context context) {
    // Avoid a trailing \n -- the GWT class source file composer will output an
    // ugly extra newline if we do that.
    String text = context.toString();
    boolean first = true;
    for (String line : text.split("\n")) {
      if (first) {
        first = false;
      } else {
        writer.println();
      }
      // Indent the line relative to its current location.  writer.indent()
      // won't work, since it does the wrong thing in Javadoc.
      writer.print("  ");
      writer.print(line);
    }
  }
382787
public AbstractBuilder getMethodBuilder(ClassWriter classWriter) {
        return MethodBuilder.getInstance(context, classWriter.getTypeElement(),
            writerFactory.getMethodWriter(classWriter));
    }
134377
@Nonnull
  public static <T> UBL21WriterBuilder <T> create (@Nonnull final Class <T> aClass)
  {
    return new UBL21WriterBuilder <> (aClass);
  }
834255
public static DocumentBuilder newDocumentBuilder() {
        try {
            return PARSER_FACTORY.newDocumentBuilder();
        } catch (ParserConfigurationException e) {
            throw (Error) new AssertionError().initCause(e);
        }
    }
229325
protected void generateBlockBundleCreation(SourceWriter sourceWriter, TreeLogger logger,
      GeneratorContext context) {

    // find all subclasses of NlsBundle
    TypeOracle typeOracle = context.getTypeOracle();
    JClassType bundleClass = typeOracle.findType(NlsBundle.class.getName());
    JClassType bundleWithLookupClass = typeOracle.findType(NlsBundleWithLookup.class.getName());
    JClassType[] types = typeOracle.getTypes();
    int bundleCount = 0;
    logger.log(Type.INFO, "Checking " + types.length + " types...");
    for (JClassType type : types) {
      if ((type.isAssignableTo(bundleClass))
          && (!type.equals(bundleClass) && (!type.equals(bundleWithLookupClass)))) {
        logger.log(Type.INFO, "Found NlsBundle interface: " + type);

        sourceWriter.print("if (");
        sourceWriter.print(type.getQualifiedSourceName());
        sourceWriter.println(".class == bundleInterface) {");
        sourceWriter.indent();

        sourceWriter.print("bundle = GWT.create(");
        sourceWriter.print(type.getQualifiedSourceName());
        sourceWriter.println(".class);");

        sourceWriter.println("register(bundleInterface, bundle);");

        sourceWriter.outdent();
        sourceWriter.print("} else ");

        bundleCount++;
      }
    }
    sourceWriter.println("{");
    sourceWriter.indent();

    sourceWriter.print("throw new ");
    sourceWriter.print(IllegalStateException.class.getSimpleName());
    sourceWriter.println("(\"Undefined NlsBundle \" + bundleInterface.getName());");

    sourceWriter.outdent();
    sourceWriter.println("}");

    logger.log(Type.INFO, "Found " + bundleCount + " NlsBundle interface(s).");
  }
1176827
public static PropertyBuilder getInstance(Context context,
            ClassDoc classDoc,
            PropertyWriter writer) {
        return new PropertyBuilder(context, classDoc, writer);
    }
1354037
public void parseAndProcess(
            final TemplateSpec templateSpec,
            final IContext context,
            final Writer writer) {

        Validate.notNull(templateSpec, "Template Specification cannot be null");
        Validate.notNull(context, "Context cannot be null");
        Validate.notNull(writer, "Writer cannot be null");


        // TemplateSpec will already have validated its contents, so need to do it here (template selectors,
        // resolution attributes, etc.)

        final String template = templateSpec.getTemplate();
        final Set<String> templateSelectors = templateSpec.getTemplateSelectors();
        final TemplateMode templateMode = templateSpec.getTemplateMode();
        final Map<String, Object> templateResolutionAttributes = templateSpec.getTemplateResolutionAttributes();

        final TemplateCacheKey cacheKey =
                    new TemplateCacheKey(
                            null, // ownerTemplate
                            template, templateSelectors,
                            0, 0, // lineOffset, colOffset
                            templateMode,
                            templateResolutionAttributes);


        /*
         * First look at the cache - it might be already cached
         */
        if (this.templateCache != null) {

            final TemplateModel cached =  this.templateCache.get(cacheKey);

            if (cached != null) {

                final IEngineContext engineContext =
                        EngineContextManager.prepareEngineContext(this.configuration, cached.getTemplateData(), templateResolutionAttributes, context);

                /*
                 * Create the handler chain to process the data.
                 * This is PARSE + PROCESS, so its called from the TemplateEngine, and the only case in which we should apply
                 * both pre-processors and post-processors (besides creating a last output-to-writer step)
                 */
                final ProcessorTemplateHandler processorTemplateHandler = new ProcessorTemplateHandler();
                final ITemplateHandler processingHandlerChain =
                        createTemplateProcessingHandlerChain(engineContext, true, true, processorTemplateHandler, writer);

                cached.process(processingHandlerChain);

                EngineContextManager.disposeEngineContext(engineContext);

                return;

            }

        }


        /*
         * Resolve the template
         */
        final TemplateResolution templateResolution =
                resolveTemplate(this.configuration, null, template, templateResolutionAttributes, true);


        /*
         * Build the TemplateData object
         */
        final TemplateData templateData =
                buildTemplateData(templateResolution, template, templateSelectors, templateMode, true);


        /*
         * Prepare the context instance that corresponds to this execution of the template engine
         */
        final IEngineContext engineContext =
                EngineContextManager.prepareEngineContext(this.configuration, templateData, templateResolutionAttributes, context);


        /*
         * Create the handler chain to process the data.
         * This is PARSE + PROCESS, so its called from the TemplateEngine, and the only case in which we should apply
         * both pre-processors and post-processors (besides creating a last output-to-writer step)
         */
        final ProcessorTemplateHandler processorTemplateHandler = new ProcessorTemplateHandler();
        final ITemplateHandler processingHandlerChain =
                createTemplateProcessingHandlerChain(engineContext, true, true, processorTemplateHandler, writer);


        /*
         * Obtain the parser
         */
        final ITemplateParser parser = getParserForTemplateMode(engineContext.getTemplateMode());


        /*
         * If the resolved template is cacheable, so we will first read it as an object, cache it, and then process it
         */
        if (templateResolution.getValidity().isCacheable() && this.templateCache != null) {

            // Create the handler chain to create the Template object
            final ModelBuilderTemplateHandler builderHandler = new ModelBuilderTemplateHandler(this.configuration, templateData);

            // Process the template into a TemplateModel
            parser.parseStandalone(
                    this.configuration,
                    null, template, templateSelectors, templateData.getTemplateResource(),
                    engineContext.getTemplateMode(), templateResolution.getUseDecoupledLogic(), builderHandler);

            // Obtain the TemplateModel
            final TemplateModel templateModel = builderHandler.getModel();

            // Put the new template into cache
            this.templateCache.put(cacheKey, templateModel);

            // Process the read (+cached) template itself
            templateModel.process(processingHandlerChain);

        } else {

            //  Process the template, which is not cacheable (so no worry about caching)
            parser.parseStandalone(
                    this.configuration,
                    null, template, templateSelectors, templateData.getTemplateResource(),
                    engineContext.getTemplateMode(), templateResolution.getUseDecoupledLogic(),  processingHandlerChain);

        }


        /*
         * Dispose the engine context now that processing has been done
         */
        EngineContextManager.disposeEngineContext(engineContext);


    }