All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gw.lang.ir.builder.IRFieldBuilder Maven / Gradle / Ivy

There is a newer version: 1.18.2
Show newest version
/*
 * Copyright 2014 Guidewire Software, Inc.
 */

package gw.lang.ir.builder;

import gw.lang.ir.IRType;
import gw.lang.ir.statement.IRFieldDecl;
import gw.lang.reflect.IType;
import gw.lang.UnstableAPI;

@UnstableAPI
public class IRFieldBuilder extends IRFeatureBuilder {

  private IRClassBuilder _classBuilder;
  private String _name;
  private IRType _type;

  public IRFieldBuilder(IRClassBuilder classBuilder) {
    _classBuilder = classBuilder;
  }

  public IRFieldBuilder withName( String name ) {
    _name = name;
    return this;
  }

  public IRFieldBuilder withType( Class type ) {
    return withType( getIRType( type ) );
  }

  public IRFieldBuilder withType( IType type ) {
    return withType( getIRType( type ) );
  }

  public IRFieldBuilder withType( IRType type ) {
    _type = type;
    return this;
  }

  public IRFieldDecl build() {
    IRFieldDecl fieldDecl = new IRFieldDecl( _modifiers, false, _name, _type, null );
    _classBuilder.withField( fieldDecl );
    return fieldDecl;
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy