Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Tracking the beginning of inspecting constructors.

  • Loading branch information...
commit 38427e0222eb5a38f7e7c71d3a5f7bd11776cfba 1 parent 0e489cb
James Ladd jamesladd authored
7 src/main/java/st/redline/core/reflector/ConstructorInspector.java
View
@@ -22,6 +22,7 @@
private StringBuilder methodSymbol = new StringBuilder();
private String[] javaArgumentTypes;
private String classNameAdaptor;
+ private int constructorsCount;
public ConstructorInspector(Reflector reflector) {
this.reflector = reflector;
@@ -35,8 +36,12 @@ public void visitEnd(String suffix, String className) {
throw new IllegalStateException("This inspector should not be getting this.");
}
+ public void visitConstructorsBegin(String suffix, String className) {
+ constructorsCount = 0;
+ }
+
public void visitConstructorsEnd(String suffix, String className) {
- this.classNameAdaptor = className.substring(className.lastIndexOf('.') + 1) + suffix;
+ classNameAdaptor = className.substring(className.lastIndexOf('.') + 1) + suffix;
reflector.append("\n")
.append(classNameAdaptor)
.append(" class atSelector: #with: put: [ :args || selector |\n")
5 src/main/java/st/redline/core/reflector/Inspector.java
View
@@ -25,6 +25,7 @@ public void inspectWith(InspectorVisitor inspectorVisitor) {
}
private void inspectConstructorsWith(InspectorVisitor inspectorVisitor) {
+ inspectConstructorsBegin(inspectorVisitor);
Constructor[] constructors = theClass.getDeclaredConstructors();
for (int i = 0; i < constructors.length; i++)
if (Modifier.isPublic(constructors[i].getModifiers()))
@@ -32,6 +33,10 @@ private void inspectConstructorsWith(InspectorVisitor inspectorVisitor) {
inspectConstructorsEnd(inspectorVisitor);
}
+ private void inspectConstructorsBegin(InspectorVisitor inspectorVisitor) {
+ inspectorVisitor.visitConstructorsBegin(suffix, theClass.getName());
+ }
+
private void inspectConstructorsEnd(InspectorVisitor inspectorVisitor) {
inspectorVisitor.visitConstructorsEnd(suffix, theClass.getName());
}
1  src/main/java/st/redline/core/reflector/InspectorVisitor.java
View
@@ -6,6 +6,7 @@
void visitEnd(String suffix, String className);
void visitConstructorBegin(String suffix, String className, String constructorName, int parameterCount);
void visitConstructorEnd(String suffix, String className, String constructorName, int parameterCount);
+ void visitConstructorsBegin(String suffix, String className);
void visitConstructorsEnd(String suffix, String className);
void visitParameterTypesBegin(int length);
void visitParameterTypesEnd(int length);
4 src/main/java/st/redline/core/reflector/NoOpInspector.java
View
@@ -19,6 +19,10 @@ public void visitConstructorEnd(String suffix, String className, String construc
throw new IllegalStateException("This inspector should not be getting this.");
}
+ public void visitConstructorsBegin(String suffix, String className) {
+ throw new IllegalStateException("This inspector should not be getting this.");
+ }
+
public void visitConstructorsEnd(String suffix, String className) {
throw new IllegalStateException("This inspector should not be getting this.");
}
4 src/main/java/st/redline/core/reflector/Reflector.java
View
@@ -55,6 +55,10 @@ public void visitConstructorBegin(String suffix, String className, String constr
currentReflector().visitConstructorBegin(suffix, className, constructorName, parameterCount);
}
+ public void visitConstructorsBegin(String suffix, String className) {
+ currentReflector().visitConstructorsBegin(suffix, className);
+ }
+
public void visitConstructorsEnd(String suffix, String className) {
currentReflector().visitConstructorsEnd(suffix, className);
}
5 src/main/java/st/redline/core/reflector/StartingInspector.java
View
@@ -24,6 +24,11 @@ public void visitEnd(String suffix, String fullClassName) {
.append(" initialize.\n");
}
+ public void visitConstructorsBegin(String suffix, String className) {
+ this.reflector.useConstructorVisitor();
+ this.reflector.visitConstructorsBegin(suffix, className);
+ }
+
public void visitConstructorsEnd(String suffix, String className) {
this.reflector.useConstructorVisitor();
this.reflector.visitConstructorsEnd(suffix, className);
Please sign in to comment.
Something went wrong with that request. Please try again.