1 2 29 package com.puppycrawl.tools.checkstyle.checks.usage.transmogrify; 30 31 import java.lang.reflect.Field ; 32 33 34 35 42 public class ExternalVariable extends ExternalDefinition implements IVariable { 43 Field _javaField; 44 45 public ExternalVariable(Field javaField) { 46 _javaField = javaField; 47 } 48 49 public String getName() { 50 return _javaField.getName(); 51 } 52 53 public String getQualifiedName() { 54 return new ExternalClass(_javaField.getDeclaringClass()).getQualifiedName() + "." + getName(); 55 } 56 57 64 public IClass getType() { 65 IClass result = null; 66 67 if (_javaField.getType().isArray()) { 68 result = new ArrayDef(new ExternalClass(_javaField.getType().getComponentType())); 69 } 70 else { 71 result = new ExternalClass(_javaField.getType()); 72 } 73 74 return result; 75 } 76 } 77 | Popular Tags |