FileDocCategorySizeDatePackage
ConstructorInfo.javaAPI DocAndroid 1.5 API4704Wed May 06 22:41:00 BST 2009com.android.apicheck

ConstructorInfo

public class ConstructorInfo extends Object implements AbstractMethodInfo

Fields Summary
private String
mName
private String
mType
private boolean
mIsStatic
private boolean
mIsFinal
private String
mDeprecated
private String
mScope
private List
mExceptions
private List
mParameters
private boolean
mExistsInBoth
private SourcePositionInfo
mSourcePosition
private ClassInfo
mClass
Constructors Summary
public ConstructorInfo(String name, String type, boolean isStatic, boolean isFinal, String deprecated, String scope, SourcePositionInfo pos, ClassInfo clazz)

        mName = name;
        mType = type;
        mIsStatic = isStatic;
        mIsFinal = isFinal;
        mDeprecated= deprecated;
        mScope = scope;
        mExistsInBoth = false;
        mExceptions = new ArrayList<String>();
        mParameters = new ArrayList<ParameterInfo>();
        mSourcePosition = pos;
        mClass = clazz;
    
Methods Summary
public voidaddException(java.lang.String exec)

        mExceptions.add(exec);
    
public voidaddParameter(ParameterInfo pInfo)

        mParameters.add(pInfo);
    
public java.lang.StringgetHashableName()

      String returnString = qualifiedName();
      for (ParameterInfo pInfo : mParameters) {
          returnString += ":" + pInfo.getType();
      }
      return returnString;
    
public booleanisConsistent(com.android.apicheck.ConstructorInfo mInfo)

      mInfo.mExistsInBoth = true;
      mExistsInBoth = true;
      boolean consistent = true;
      
      if (mIsFinal != mInfo.mIsFinal) {
          consistent = false;
          Errors.error(Errors.CHANGED_FINAL, mInfo.position(),
                  "Constructor " + mInfo.qualifiedName() + " has changed 'final' qualifier");
      }
      
      if (mIsStatic != mInfo.mIsStatic) {
          consistent = false;
          Errors.error(Errors.CHANGED_FINAL, mInfo.position(),
                  "Constructor " + mInfo.qualifiedName() + " has changed 'static' qualifier");
      }
     
      if (!mScope.equals(mInfo.mScope)) {
          consistent = false;
          Errors.error(Errors.CHANGED_SCOPE, mInfo.position(),
                  "Constructor " + mInfo.qualifiedName() + " changed scope from "
                  + mScope + " to " + mInfo.mScope);
      }
      
      if (!mDeprecated.equals(mInfo.mDeprecated)) {
          consistent = false;
          Errors.error(Errors.CHANGED_DEPRECATED, mInfo.position(),
                  "Constructor " + mInfo.qualifiedName() + " has changed deprecation state");
      }
      
      for (String exec : mExceptions) {
          if (!mInfo.mExceptions.contains(exec)) {
              Errors.error(Errors.CHANGED_THROWS, mInfo.position(),
                      "Constructor " + mInfo.qualifiedName() + " no longer throws exception "
                      + exec);
              consistent = false;
          }
      }
      
      for (String exec : mInfo.mExceptions) {
          if (!mExceptions.contains(exec)) {
              Errors.error(Errors.CHANGED_THROWS, mInfo.position(),
                      "Constructor " + mInfo.qualifiedName() + " added thrown exception "
                      + exec);
            consistent = false;
          }
      }
      
      return consistent;
  
public booleanisInBoth()

        return mExistsInBoth;
    
public java.lang.Stringname()

        return mName;
    
public SourcePositionInfoposition()

        return mSourcePosition;
    
public java.lang.StringprettySignature()

        String params = "";
        for (ParameterInfo pInfo : mParameters) {
            if (params.length() > 0) {
                params += ", ";
            }
            params += pInfo.getType();
        }
        return qualifiedName() + '(" + params + ')";
    
public java.lang.StringqualifiedName()

        String baseName = (mClass != null)
                ? (mClass.qualifiedName() + ".")
                : "";
        return baseName + name();