Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2014 itemis AG (http://www.itemis.eu) and others. All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html
  
  package org.eclipse.xtext.xbase.compiler;
  
 import java.util.Set;
 import  org.eclipse.xtend.lib.annotations.Accessors;
 import  org.eclipse.xtend.lib.annotations.Data;
 import  org.eclipse.xtend.lib.macro.file.Path;
 import  org.eclipse.xtext.generator.FileSystemSupportBasedFileSystemAccess;
 import  org.eclipse.xtext.xbase.lib.CollectionLiterals;
 import  org.eclipse.xtext.xbase.lib.Pure;
 import  org.eclipse.xtext.xbase.lib.util.ToStringBuilder;

Author(s):
Sven Efftinge - Initial contribution and API
Since:
2.7
Noextend:
This class is not intended to be subclassed by clients.
Noreference:
This class is not intended to be referenced by clients.
 
 public class RegisteringFileSystemAccess extends FileSystemSupportBasedFileSystemAccess {
   @Data
   public static class GeneratedFile {
     private final Path path;
     
     private final String javaClassName;
     
     private final CharSequence contents;
     
     public GeneratedFile(final Path pathfinal String javaClassNamefinal CharSequence contents) {
       super();
       this. = path;
       this. = javaClassName;
       this. = contents;
     }
     
     @Override
     @Pure
     public int hashCode() {
       final int prime = 31;
       int result = 1;
       result = prime * result + ((this.== null) ? 0 : this..hashCode());
       result = prime * result + ((this.== null) ? 0 : this..hashCode());
       result = prime * result + ((this.== null) ? 0 : this..hashCode());
       return result;
     }
     
     @Override
     @Pure
     public boolean equals(final Object obj) {
       if (this == obj)
         return true;
       if (obj == null)
         return false;
       if (getClass() != obj.getClass())
         return false;
       if (this. == null) {
         if (other.path != null)
           return false;
       } else if (!this..equals(other.path))
         return false;
       if (this. == null) {
         if (other.javaClassName != null)
           return false;
       } else if (!this..equals(other.javaClassName))
         return false;
       if (this. == null) {
         if (other.contents != null)
           return false;
       } else if (!this..equals(other.contents))
         return false;
       return true;
     }
     
     @Override
     @Pure
     public String toString() {
       ToStringBuilder b = new ToStringBuilder(this);
       b.add("path"this.);
       b.add("javaClassName"this.);
       b.add("contents"this.);
       return b.toString();
     }
     
     @Pure
     public Path getPath() {
       return this.;
     }
     
     @Pure
     public String getJavaClassName() {
       return this.;
    }
    
    @Pure
    public CharSequence getContents() {
      return this.;
    }
  }
  
  @Accessors
  private final Set<RegisteringFileSystemAccess.GeneratedFiletextFiles = CollectionLiterals.<RegisteringFileSystemAccess.GeneratedFile>newHashSet();
  
  public void generateFile(final String fileNamefinal String outputConfigurationNamefinal CharSequence contents) {
    super.generateFile(fileNameoutputConfigurationNamecontents);
    final Path path = this.getPath(fileNameoutputConfigurationName);
    String _xifexpression = null;
    boolean _endsWith = fileName.endsWith(".java");
    if (_endsWith) {
      int _length = fileName.length();
      int _minus = (_length - 5);
      String _substring = fileName.substring(0, _minus);
      _xifexpression = _substring.replace("/"".");
    }
    final String javaName = _xifexpression;
    RegisteringFileSystemAccess.GeneratedFile _generatedFile = new RegisteringFileSystemAccess.GeneratedFile(pathjavaNamecontents);
    this..add(_generatedFile);
  }
  
  @Pure
    return this.;
  }
New to GrepCode? Check out our FAQ X