Class UnnecessaryInstantiationAstVisitor

java.lang.Object
org.codehaus.groovy.ast.CodeVisitorSupport
org.codehaus.groovy.ast.ClassCodeVisitorSupport
org.codenarc.rule.AbstractAstVisitor
org.codenarc.rule.unnecessary.UnnecessaryInstantiationAstVisitor
All Implemented Interfaces:
groovy.lang.GroovyObject, org.codehaus.groovy.ast.GroovyClassVisitor, org.codehaus.groovy.ast.GroovyCodeVisitor, AstVisitor
Direct Known Subclasses:
UnnecessaryBigDecimalInstantiationAstVisitor, UnnecessaryBigIntegerInstantiationAstVisitor, UnnecessaryDoubleInstantiationAstVisitor, UnnecessaryFloatInstantiationAstVisitor, UnnecessaryIntegerInstantiationAstVisitor, UnnecessaryLongInstantiationAstVisitor

public class UnnecessaryInstantiationAstVisitor extends AbstractAstVisitor implements groovy.lang.GroovyObject
  • Constructor Details

    • UnnecessaryInstantiationAstVisitor

      public UnnecessaryInstantiationAstVisitor(Class targetType, List<Class> parameterTypes, String suffix)
  • Method Details

    • getMetaClass

      public groovy.lang.MetaClass getMetaClass()
      Specified by:
      getMetaClass in interface groovy.lang.GroovyObject
    • setMetaClass

      public void setMetaClass(groovy.lang.MetaClass mc)
      Specified by:
      setMetaClass in interface groovy.lang.GroovyObject
    • invokeMethod

      public Object invokeMethod(String method, Object arguments)
      Specified by:
      invokeMethod in interface groovy.lang.GroovyObject
    • getProperty

      public Object getProperty(String property)
      Specified by:
      getProperty in interface groovy.lang.GroovyObject
    • setProperty

      public void setProperty(String property, Object value)
      Specified by:
      setProperty in interface groovy.lang.GroovyObject
    • getTargetType

      public Class getTargetType()
    • setTargetType

      public void setTargetType(Class value)
    • getParameterTypes

      public List<Class> getParameterTypes()
    • setParameterTypes

      public void setParameterTypes(List<Class> value)
    • getSuffix

      public String getSuffix()
    • setSuffix

      public void setSuffix(String value)
    • isTypeSuffixNecessary

      protected boolean isTypeSuffixNecessary(Object argument)
    • visitConstructorCallExpression

      public final void visitConstructorCallExpression(org.codehaus.groovy.ast.expr.ConstructorCallExpression call)
      Specified by:
      visitConstructorCallExpression in interface org.codehaus.groovy.ast.GroovyCodeVisitor
      Overrides:
      visitConstructorCallExpression in class org.codehaus.groovy.ast.CodeVisitorSupport
    • shouldSkipViolation

      protected boolean shouldSkipViolation(Object value)