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

gw.lang.reflect.gs.LazyStringSourceFileHandle Maven / Gradle / Ivy

There is a newer version: 1.18.2
Show newest version
package gw.lang.reflect.gs;

import gw.lang.parser.ISource;
import java.util.concurrent.Callable;

/**
 */
public class LazyStringSourceFileHandle extends StringSourceFileHandle
{
  private Callable _sourceGen;
  private String _namespace;

  public LazyStringSourceFileHandle( String nspace, String fqn, Callable sourceGen, ClassType classType )
  {
    super( fqn, null, false, classType );
    _namespace = nspace;
    _sourceGen = sourceGen;
  }

  public String getTypeNamespace()
  {
    return _namespace;
  }

  @Override
  public ISource getSource()
  {
    if( getRawSource() == null )
    {
      try
      {
        setRawSource( _sourceGen.call() );
      }
      catch( Exception e )
      {
        throw new RuntimeException( e );
      }
    }
    return super.getSource();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy