/** * Whether the field or the variable is of String type. * @param objCalledOn the field or the variable to check. * @return true if the field or the variable is of String type. */ private boolean isStringFieldOrVariable(DetailAST objCalledOn) { boolean result = false; final String name = objCalledOn.getText(); FieldFrame frame = currentFrame; while (frame != null) { final DetailAST field = frame.findField(name); if (field != null && (frame.isClassOrEnumOrEnumConstDef() || checkLineNo(field, objCalledOn))) { result = STRING.equals(getFieldType(field)); break; } frame = frame.getParent(); } return result; }
/** * Whether the field or the variable is of String type. * @param objCalledOn the field or the variable to check. * @return true if the field or the variable is of String type. */ private boolean isStringFieldOrVariable(DetailAST objCalledOn) { boolean result = false; final String name = objCalledOn.getText(); FieldFrame frame = currentFrame; while (frame != null) { final DetailAST field = frame.findField(name); if (field != null && (frame.isClassOrEnumOrEnumConstDef() || checkLineNo(field, objCalledOn))) { result = STRING.equals(getFieldType(field)); break; } frame = frame.getParent(); } return result; }
/** * Get the nearest parent frame which is CLASS_DEF, ENUM_DEF or ENUM_CONST_DEF. * @param frame to start the search from. * @return the nearest parent frame which is CLASS_DEF, ENUM_DEF or ENUM_CONST_DEF. */ private static FieldFrame getObjectFrame(FieldFrame frame) { FieldFrame objectFrame = frame; while (objectFrame != null && !objectFrame.isClassOrEnumOrEnumConstDef()) { objectFrame = objectFrame.getParent(); } return objectFrame; }
/** * Get the nearest parent frame which is CLASS_DEF, ENUM_DEF or ENUM_CONST_DEF. * @param frame to start the search from. * @return the nearest parent frame which is CLASS_DEF, ENUM_DEF or ENUM_CONST_DEF. */ private static FieldFrame getObjectFrame(FieldFrame frame) { FieldFrame objectFrame = frame; while (objectFrame != null && !objectFrame.isClassOrEnumOrEnumConstDef()) { objectFrame = objectFrame.getParent(); } return objectFrame; }