1 19 package gcc.generator; 20 21 public class JReturnType 22 { 23 protected Class _type; 24 protected String _typeName; 25 protected boolean _isArray; 26 27 public JReturnType( Class type) 28 { 29 this( type, false ); 30 } 31 32 public JReturnType( Class type, boolean isArray ) 33 { 34 _type = type; 35 _typeName = type.getName(); 36 _isArray = isArray; 37 } 38 39 public JReturnType( String typeName ) 40 { 41 this( typeName, false ); 42 } 43 44 public JReturnType( String typeName, boolean isArray ) 45 { 46 _typeName = typeName; 47 _isArray = isArray; 48 49 try 50 { 51 _type = Class.forName(_typeName); 52 } 53 catch( Exception e ) 54 { 55 } 57 } 58 59 public void setType( Class type ) 60 { 61 _type = type; 62 _typeName = type.getName(); 63 } 64 65 public Class getType() 66 { 67 return _type; 68 } 69 70 public void setTypeName( String typeName ) 71 { 72 _type = null; 73 _typeName = typeName; 74 } 75 76 public String getTypeName() 77 { 78 return _typeName; 79 } 80 81 public boolean isArray() 82 { 83 return _isArray; 84 } 85 86 public int hashCode() 87 { 88 return _type.hashCode(); 89 } 90 91 public boolean equals( Object other ) 92 { 93 boolean rc = false; 94 95 if (other == this) 96 { 97 rc = true; 98 } 99 else if (other instanceof gcc.generator.JReturnType) 100 { 101 gcc.generator.JReturnType jr = (gcc.generator.JReturnType)other; 102 103 rc = jr._typeName.equals(_typeName); 104 } 105 106 return rc; 107 } 108 } 109 | Popular Tags |