Skip to content

Commit

Permalink
updated class name
Browse files Browse the repository at this point in the history
  • Loading branch information
Leon authored and Leon committed Sep 30, 2017
1 parent e244f27 commit d18995f
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 23 deletions.
34 changes: 23 additions & 11 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
*/
public class ClassDescriber {
private final Class<?> cls;
private final Modifiers modifiers;
private final ModifierSpy modifiers;
private String description;

public ClassDescriber(Class<?> cls) {
this.cls = cls;
this.modifiers = new Modifiers(cls);
this.modifiers = new ModifierSpy(cls);
}

public String toString() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public FieldDescriber(Field field) {
this.field = field;
}
public String toString() {
Modifiers modifiers = new Modifiers(field);
ModifierSpy modifiers = new ModifierSpy(field);
String description = "declare %s %s field named `%s` of type `%s`. The field has `%s` accessibility.";
return String.format(description,
modifiers.getStaticism(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class MethodDescriber {

public MethodDescriber(Method method) {
this.method = method;
this.description = new Modifiers(method).isAbstract() ? "Declare " : "Define ";
this.description = new ModifierSpy(method).isAbstract() ? "Declare " : "Define ";
}

public String toString() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,26 @@
/**
* Created by leon on 9/29/17.
*/
public class Modifiers {
public class ModifierSpy {
private final String modifiers;
private String staticism;
private String finalism;

public Modifiers(int modifiers) {
public ModifierSpy(int modifiers) {
this.modifiers = Modifier.toString(modifiers);
}

public Modifiers(Class c) {
public ModifierSpy(Class c) {
this(c.getModifiers());
}

public Modifiers(Field f) {
public ModifierSpy(Field f) {
this(f.getModifiers());
}

public Modifiers(Method m) {
public ModifierSpy(Method m) {
this(m.getModifiers());
}

public Modifiers(Parameter p) {
public ModifierSpy(Parameter p) {
this(p.getModifiers());
}

Expand Down

0 comments on commit d18995f

Please sign in to comment.