Skip to content

Commit

Permalink
Merge pull request #328 from jsight/ejb_session_example
Browse files Browse the repository at this point in the history
Added the ability to start a JavaClass from an already existing variable...
  • Loading branch information
lincolnthree committed Oct 24, 2014
2 parents 329b15c + d60bdd6 commit 29da0d7
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 26 deletions.
Expand Up @@ -10,46 +10,46 @@ public interface FileLocationModel extends FileReferenceModel
{

String TYPE = "fileLocationModel";
String PROPERTY_LINE_NUMBER = "lineNumber";
String PROPERTY_LENGTH = "length";
String PROPERTY_COLUMN_NUMBER = "startPosition";
String LINE_NUMBER = "lineNumber";
String LENGTH = "length";
String COLUMN_NUMBER = "startPosition";

/**
* Set the line number at which this {@link InlineHintModel} should appear in the designated {@link FileModel}.
*/
@Property(PROPERTY_LINE_NUMBER)
@Property(LINE_NUMBER)
public void setLineNumber(int lineNumber);

/**
* Get the line number at which this {@link InlineHintModel} should appear in the designated {@link FileModel}.
*/
@Property(PROPERTY_LINE_NUMBER)
@Property(LINE_NUMBER)
public int getLineNumber();

/**
* Set the column number at which this {@link InlineHintModel} should appear in the designated {@link FileModel}.
*/
@Property(PROPERTY_COLUMN_NUMBER)
@Property(COLUMN_NUMBER)
public void setColumnNumber(int startPosition);

/**
* Get the column number at which this {@link InlineHintModel} should appear in the designated {@link FileModel}.
*/
@Property(PROPERTY_COLUMN_NUMBER)
@Property(COLUMN_NUMBER)
public int getColumnNumber();

/**
* Set the length of content for which this {@link InlineHintModel} should cover in the designated {@link FileModel}
* .
*/
@Property(PROPERTY_LENGTH)
@Property(LENGTH)
public void setLength(int length);

/**
* Get the length of content for which this {@link InlineHintModel} should cover in the designated {@link FileModel}
* .
*/
@Property(PROPERTY_LENGTH)
@Property(LENGTH)
public int getLength();

}
Expand Up @@ -50,6 +50,14 @@ public static JavaClassBuilder references(String regex)
return new JavaClass(regex);
}

/**
* Create a new {@link JavaClass} {@link Condition} based upon the provided Java regular expression.
*/
public static JavaClassBuilderReferences from(String inputVarName)
{
return new JavaClassBuilderReferences(inputVarName);
}

public JavaClassBuilderInFile inFile(String regex)
{
this.fileRegex = regex;
Expand Down Expand Up @@ -139,5 +147,4 @@ public String toString()
builder.append(".as(" + variable + ")");
return builder.toString();
}

}
@@ -0,0 +1,18 @@
package org.jboss.windup.rules.apps.java.condition;

public class JavaClassBuilderReferences
{
private String inputVarName;

public JavaClassBuilderReferences(String inputVarName)
{
this.inputVarName = inputVarName;
}

public JavaClassBuilder references(String regex)
{
JavaClassBuilder javaClass = JavaClass.references(regex);
((JavaClass) javaClass).setInputVariablesName(this.inputVarName);
return javaClass;
}
}
Expand Up @@ -19,7 +19,7 @@ public interface JavaClassModel extends WindupVertexFrame
{
public static final String JAVA_METHOD = "javaMethod";
public static final String CLASS_FILE = "classFile";
public static final String JAVA_CLASS = "javaClass";
public static final String ORIGINAL_SOURCE = "originalSource";
public static final String DECOMPILED_SOURCE = "decompiledSource";
public static final String IMPLEMENTS = "implements";
public static final String EXTENDS = "extends";
Expand Down Expand Up @@ -106,43 +106,37 @@ public interface JavaClassModel extends WindupVertexFrame
public Iterable<JavaClassModel> getImplements();

/**
* Contains the {@link JavaSourceFileModel} of the decompiled version of this file (assuming that it originally was
* decompiled from a .class file)
* Contains the {@link JavaSourceFileModel} of the decompiled version of this file (assuming that it originally was decompiled from a .class file)
*/
@Adjacency(label = DECOMPILED_SOURCE, direction = Direction.OUT)
public void setDecompiledSource(JavaSourceFileModel source);

/**
* Contains the {@link JavaSourceFileModel} of the decompiled version of this file (assuming that it originally was
* decompiled from a .class file)
* Contains the {@link JavaSourceFileModel} of the decompiled version of this file (assuming that it originally was decompiled from a .class file)
*/
@Adjacency(label = DECOMPILED_SOURCE, direction = Direction.OUT)
public JavaSourceFileModel getDecompiledSource();

/**
* Contains the original source code of this file, assuming that it was originally provided in source form (and not
* via a decompilation).
* Contains the original source code of this file, assuming that it was originally provided in source form (and not via a decompilation).
*/
@Adjacency(label = JAVA_CLASS, direction = Direction.OUT)
@Adjacency(label = ORIGINAL_SOURCE, direction = Direction.OUT)
public void setOriginalSource(JavaSourceFileModel source);

/**
* Contains the original source code of this file, assuming that it was originally provided in source form (and not
* via a decompilation).
* Contains the original source code of this file, assuming that it was originally provided in source form (and not via a decompilation).
*/
@Adjacency(label = JAVA_CLASS, direction = Direction.OUT)
@Adjacency(label = ORIGINAL_SOURCE, direction = Direction.OUT)
public JavaSourceFileModel getOriginalSource();

/**
* Contains the original .class file, assuming that it was originally provided in binary form (as a java .class
* file)
* Contains the original .class file, assuming that it was originally provided in binary form (as a java .class file)
*/
@Adjacency(label = CLASS_FILE, direction = Direction.OUT)
public FileModel getClassFile();

/**
* Contains the original .class file, assuming that it was originally provided in binary form (as a java .class
* file)
* Contains the original .class file, assuming that it was originally provided in binary form (as a java .class file)
*/
@Adjacency(label = CLASS_FILE, direction = Direction.OUT)
public FileModel setClassFile(FileModel file);
Expand Down
Expand Up @@ -157,7 +157,7 @@ private void addParsedClassToFile(FileInputStream fis, GraphContext context, Jav

JavaClassService javaClassService = new JavaClassService(context);
JavaClassModel javaClassModel = javaClassService.getOrCreate(qualifiedName);

javaClassModel.setOriginalSource(sourceFileModel);
javaClassModel.setSimpleName(simpleName);
javaClassModel.setPackageName(packageName);
javaClassModel.setQualifiedName(qualifiedName);
Expand Down

0 comments on commit 29da0d7

Please sign in to comment.