ConstructorInfopublic 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 void | addException(java.lang.String exec)
mExceptions.add(exec);
| public void | addParameter(ParameterInfo pInfo)
mParameters.add(pInfo);
| public java.lang.String | getHashableName()
String returnString = qualifiedName();
for (ParameterInfo pInfo : mParameters) {
returnString += ":" + pInfo.getType();
}
return returnString;
| public boolean | isConsistent(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 boolean | isInBoth()
return mExistsInBoth;
| public java.lang.String | name()
return mName;
| public SourcePositionInfo | position()
return mSourcePosition;
| public java.lang.String | prettySignature()
String params = "";
for (ParameterInfo pInfo : mParameters) {
if (params.length() > 0) {
params += ", ";
}
params += pInfo.getType();
}
return qualifiedName() + '(" + params + ')";
| public java.lang.String | qualifiedName()
String baseName = (mClass != null)
? (mClass.qualifiedName() + ".")
: "";
return baseName + name();
|
|